feat: add mark-staff/mark-student endpoints with studentStatus in user list
This commit is contained in:
@@ -127,8 +127,9 @@ export class RbacController {
|
||||
|
||||
@Get('users')
|
||||
@RequirePermission('user:view')
|
||||
getUsers() {
|
||||
return this.rbacService.findAllUsers();
|
||||
getUsers(@Query('isArchived') isArchived?: string) {
|
||||
const archived = isArchived === 'true';
|
||||
return this.rbacService.findAllUsers(archived);
|
||||
}
|
||||
|
||||
@Post('users')
|
||||
@@ -219,6 +220,50 @@ export class RbacController {
|
||||
}
|
||||
}
|
||||
|
||||
@Put('users/:id/archive')
|
||||
@RequirePermission('user:edit')
|
||||
async archiveUser(@Param('id') id: string) {
|
||||
try {
|
||||
return await this.rbacService.archiveUser(+id);
|
||||
} catch (e: unknown) {
|
||||
const err = e as { message?: string };
|
||||
throw new BadRequestException(err?.message);
|
||||
}
|
||||
}
|
||||
|
||||
@Put('users/:id/restore')
|
||||
@RequirePermission('user:edit')
|
||||
async restoreUser(@Param('id') id: string) {
|
||||
try {
|
||||
return await this.rbacService.restoreUser(+id);
|
||||
} catch (e: unknown) {
|
||||
const err = e as { message?: string };
|
||||
throw new BadRequestException(err?.message);
|
||||
}
|
||||
}
|
||||
|
||||
@Put('users/:id/mark-staff')
|
||||
@RequirePermission('user:edit')
|
||||
async markAsStaff(@Param('id') id: string) {
|
||||
try {
|
||||
return await this.rbacService.markAsStaff(+id);
|
||||
} catch (e: unknown) {
|
||||
const err = e as { message?: string };
|
||||
throw new BadRequestException(err?.message);
|
||||
}
|
||||
}
|
||||
|
||||
@Put('users/:id/mark-student')
|
||||
@RequirePermission('user:edit')
|
||||
async markAsStudent(@Param('id') id: string) {
|
||||
try {
|
||||
return await this.rbacService.markAsStudent(+id);
|
||||
} catch (e: unknown) {
|
||||
const err = e as { message?: string };
|
||||
throw new BadRequestException(err?.message);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 用户资料 ----
|
||||
|
||||
@Get('users/:id/profile')
|
||||
|
||||
Reference in New Issue
Block a user