-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add user organization domain/route logic #2327
Conversation
3b49834
to
8d07a86
Compare
…organization creation and updates, Add Swagger decorators
3c13f71
to
00408ed
Compare
5565dbe
to
6eb88c7
Compare
…ations parameters, update controller methods to use ParseIntPipe, Add organiation controller tests
426806e
to
69dd3ea
Compare
await entityManager.insert(DbUserOrganization, { | ||
user: { id: invitedUserId }, | ||
organization: signer.org, | ||
role: userToInvite.role, | ||
status: UserOrganizationStatus.INVITED, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when an admin invites two wallets that belong to the same user. Would this request throw for the second wallet since we are trying to insert the same user id for the same org into the user-org table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed this and initially we thought as long as we do an upsert it should be fine since for the second wallet we would just update the existing membership entry of the user but now that I think about it again what do we do if those wallets were invited with different roles? It might be highly unlikely but still leaves room for interpretation (do we keep the initial role or always also update the role again -> behaviour is not clear to the admin who invites wallets).
Overall I think if we limited this flow to single wallet invites it would make error handling a lot easier since we could detect if that user already got invited and show an error message or update the role if its different. I will bring this up in the next sync.
…organization creation and updates, Add Swagger decorators
…ations parameters, update controller methods to use ParseIntPipe, Add organiation controller tests
69cde71
to
c79d0ad
Compare
b296b07
to
01f50e2
Compare
src/datasources/organizations/entities/organizations.entity.db.ts
Outdated
Show resolved
Hide resolved
src/datasources/organizations/entities/organizations.entity.db.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Job, LGTM 🚀
Summary
This implements the domain/route layer for adding
User
s toOrganization
s, by means of theUserOrganization
s.A new
UserOrganizations
repository, with relevant methods for sending, accepting and declining invites and updating/removing users has been added to the domain layer. Respective routes for each have been included in a newUserOrganizationsController
.Changes
IUserOrganizationsRepository
with implementationUserOrganizationController
with routes for inviting, accepting and declining user invites, modifying roles and removing usersUserOrganizationService
to route repository to controller