Skip to content

164 implement user management#172

Open
Bikilaketema wants to merge 38 commits intorelease-02from
164-implement-user-management
Open

164 implement user management#172
Bikilaketema wants to merge 38 commits intorelease-02from
164-implement-user-management

Conversation

@Bikilaketema
Copy link
Collaborator

@Bikilaketema Bikilaketema commented Mar 27, 2025

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

@Bikilaketema Bikilaketema linked an issue Mar 27, 2025 that may be closed by this pull request
@Bikilaketema Bikilaketema self-assigned this Mar 27, 2025
@Bikilaketema Bikilaketema added the enhancement New feature or request label Mar 27, 2025
@Bikilaketema Bikilaketema marked this pull request as draft March 28, 2025 13:33
@Bikilaketema Bikilaketema removed the request for review from jerrygirmaa March 28, 2025 13:34
@Bikilaketema Bikilaketema marked this pull request as ready for review March 28, 2025 22:41
controllers: [AdminProfileController],
providers: [AdminProfileService, PrismaService, JwtService],
})
export class AdminProfileModule {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this module is under Admin module you dont need to name is as "AdminProfileModule"
rename this module as "ProfileModule"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed all the module and moved the logic to the user

},
});

if (!admin) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • i suggest if we manage such validation using interface before reaching our service class

}

findOne(id: number) {
return `This action returns a #${id} role`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • make sure the user has account (part of this organization) first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

Implement user management

2 participants