Open
Conversation
…to-manage-mentors-and-channels
…ole in Channel and Mentor controllers
…et-and-update-profile-endpoint-for-admin
…update-profile-endpoint-for-admin
…o feature/add-get-and-update-profile-endpoint-for-admin
…managing admin profiles
…tion and role checks
…guard with user type
…uard and RoleGuard to use id instead
…nd tests for admin profile management
bengeos
requested changes
Apr 1, 2025
| controllers: [AdminProfileController], | ||
| providers: [AdminProfileService, PrismaService, JwtService], | ||
| }) | ||
| export class AdminProfileModule {} |
Member
There was a problem hiding this comment.
If this module is under Admin module you dont need to name is as "AdminProfileModule"
rename this module as "ProfileModule"
Collaborator
Author
There was a problem hiding this comment.
I have removed all the module and moved the logic to the user
| }, | ||
| }); | ||
|
|
||
| if (!admin) { |
Member
There was a problem hiding this comment.
- i suggest if we manage such validation using interface before reaching our service class
| } | ||
|
|
||
| findOne(id: number) { | ||
| return `This action returns a #${id} role`; |
Member
There was a problem hiding this comment.
- if this service method are not necessary for now lets not push them
- avoid pushing incomplete work
|
|
||
| if (!hasActiveAccount) { | ||
| throw new ForbiddenException( | ||
| "Your organization's owner has disabled your account", |
Member
There was a problem hiding this comment.
- make sure the user has account (part of this organization) first
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented admin management endpoints. On my way to create the admin management endpoints there were other changed that I have to implement. The changes are the ff
1: Change the auth guard to change the id field in the token from sub to id when it passes it to the role guard(note that this is not during token generation)
2: Refactor the role guard so that it work, and also check if the admins account is deactivated
-> Now the token will not include the account if the relation is deactivated...so the role guard doesn't need to check that
3: Create a role management endpoint(currently it only returns the existing roles filtering by acct id) so that on the client side the existing roles are fetched and their id sent when creating an admin, cuz the admin creation endpoint requires role id which is not accessible to the client side
->Changed it to return all roles in the db without accountID cuz currently we have only one role for a user
4: Change the seed.ts to add Admin to the db
5: change the schema to add isActive field to the accountUSer table so that admin activation and deactivation is managed from there