Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

refactor(invite): use hooks and resolvers #9026

Merged
merged 7 commits into from
Oct 17, 2023
Merged

Conversation

aditya-mitra
Copy link
Collaborator

@aditya-mitra aditya-mitra commented Oct 10, 2023

Summary

🤖 Generated by Copilot at 658c907

This pull request improves the invite service by using a more consistent database interface, adding more query options and hooks, supporting external invites with identity providers and passcodes, and enhancing the test coverage and readability. It also updates the invite schema and the service registration.

References

closes part of #8871

Explanation

🤖 Generated by Copilot at 658c907

  • Add inviteType and inviteeId properties to the invite query schema and implement custom query syntax for inviteType and passcode (link)
  • Import KnexService class instead of KnexAdapter class and remove unused imports from the invite class file (link, link)
  • Simplify the invite class constructor by assigning app from options (link)
  • Import discardQuery and iffElse hooks from feathers-hooks-common and invite type schema from invite-type schema file (link, link)
  • Add helper functions to modify the query parameters based on the search string and the type of invite (link)
  • Modify the before find hook to handle the search parameter and apply different hooks based on the query type (link)
  • Modify the before remove hook to delete the user relationship between the invite sender and the invitee if the invite type is friend (link)
  • Modify the after create hook to send an email or a notification to the invitee with the invite details (link)
  • Import identity provider schema from identity provider schema file and remove unused imports from the invite resolvers file (link)
  • Add an else-if block to the inviteExternalResolver function to query the identity provider service and the user service based on the invite token (link)
  • Add a passcode property to the inviteDataResolver function to generate a random string for the invite passcode (link)
  • Rewrite the invite test file to use the invite types array and the avatar and user schemas and add the isInternal parameter to the find queries (link)
  • Modify the invite test file to use the last invite from the invites array and check the length and the content of the received and sent invites (link)
  • Modify the invite test file to check if the invites are actually removed from the database after calling the remove method (link)
  • Simplify the invite service registration by passing only the options parameter (link)

🤖 Generated by Copilot at 658c907

Oh we're the crew of the invite service, and we work with skill and grace
We add new fields and hooks and tests, to make our code a better place
We use the KnexService class, and the inviteType query
And we invite external users, with passcodes and identity

QA Steps

List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.

Checklist

  • If this PR is still a WIP, convert to a draft
  • When this PR is ready, mark it as "Ready for review"
  • ensure all checks pass
  • Changes have been manually QA'd
  • Changes reviewed by at least 2 approved reviewers

It was no longer being checked for or handled, was causing errors
on find since it was not being removed. Hook to add user id to query
should be replicating what it was doing prior to this.
@barankyle barankyle added this pull request to the merge queue Oct 17, 2023
Merged via the queue into dev with commit 5bae5ab Oct 17, 2023
11 of 13 checks passed
@barankyle barankyle deleted the refactor/invite-service-hooks branch October 17, 2023 22:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants