Skip to content

Commit

Permalink
feat: Implement PR feedback
Browse files Browse the repository at this point in the history
- Restrict organization update to admin only
- Add a max length to the name field
  • Loading branch information
Blessing Makaraba authored and Blessing Makaraba committed Jan 31, 2023
1 parent af388db commit b9370b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/api/src/app/organization/organization.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export class OrganizationController {
}

@Put('/')
@Roles(MemberRoleEnum.ADMIN)
async updateOrganization(@UserSession() user: IJwtPayload, @Body() body: { name: string }) {
return await this.updateOrganizationUsecase.execute(
UpdateOrganizationCommand.create({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { IsDefined } from 'class-validator';
import { IsDefined, MaxLength } from 'class-validator';
import { AuthenticatedCommand } from '../../../shared/commands/authenticated.command';

export class UpdateOrganizationCommand extends AuthenticatedCommand {
@IsDefined()
public readonly id: string;

@MaxLength(50)
name: string;
}

0 comments on commit b9370b6

Please sign in to comment.