Skip to content

Commit

Permalink
Merge pull request #27 from Samarth-HP/develop
Browse files Browse the repository at this point in the history
Added School as a role for admin api
  • Loading branch information
radhay-samagra authored Jul 13, 2022
2 parents 80985c2 + 16fa616 commit fc6a38e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/admin/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,39 @@ export class AdminController {
) {}

@Post('/all')
@Roles('Admin')
@Roles('Admin', 'school')
@UseGuards(JwtAuthGuard)
async fetchUsers(@Request() req, @Body() data: any): Promise<UsersResponse> {
const users: UsersResponse = await this.adminService.fetchUsers(data);
return users;
}

@Post('/changePassword')
@Roles('Admin')
@Roles('Admin', 'school')
@UseGuards(JwtAuthGuard)
async updatePassword(@Body() data: {loginId: string, password: string}): Promise<SignupResponse> {
const status: SignupResponse = await this.adminService.updatePassword(data);
return status;
}

@Post('/createUser')
@Roles('Admin')
@Roles('Admin', 'school')
@UseGuards(JwtAuthGuard)
async createUser(@Body() data: UserRegistration): Promise<SignupResponse> {
const users: SignupResponse = await this.adminService.createUser(data);
return users;
}

@Patch('/updateUser/:userId')
@Roles('Admin')
@Roles('Admin', 'school')
@UseGuards(JwtAuthGuard)
async updateUser(@Param('userId') userId: string, @Body() data: User): Promise<SignupResponse> {
const user: SignupResponse = await this.adminService.updateUser(userId, data);
return user;
}

@Get('/searchUser')
@Roles('Admin')
@Roles('Admin', 'school')
@UseGuards(JwtAuthGuard)
async searchUser(@Query() query: {queryString: string, startRow: number, numberOfResults: number}): Promise<UsersResponse> {
console.log(query.numberOfResults)
Expand All @@ -54,7 +54,7 @@ export class AdminController {
}

@Get('/user/:userId')
@Roles('Admin')
@Roles('Admin', 'school')
@UseGuards(JwtAuthGuard)
async searchUserbyId(@Param('userId') userId: string): Promise<UsersResponse> {
const users: UsersResponse = await this.adminService.fetchUsersByString(userId, undefined, undefined);
Expand Down

0 comments on commit fc6a38e

Please sign in to comment.