fix and update
This commit is contained in:
@@ -3,7 +3,7 @@ import { ApiBearerAuth, ApiBody, ApiOperation, ApiParam, ApiTags } from '@nestjs
|
||||
import { map } from 'rxjs';
|
||||
import { CoreGrpcService } from '../core-grpc.service';
|
||||
import { CurrentAdmin } from '../decorators/current-admin.decorator';
|
||||
import { ListUsersQueryDto, ResetPasswordDto, SetSuperAdminDto, UpdateUserDto } from '../dto/admin.dto';
|
||||
import { ListUsersQueryDto, ResetPasswordDto, SetSuperAdminDto, SetUserVerificationDto, UpdateUserDto } from '../dto/admin.dto';
|
||||
import { AdminGuard, AdminRequestUser, assertAdminPermission, SuperAdminGuard } from '../guards/admin.guard';
|
||||
|
||||
@ApiTags('Администрирование')
|
||||
@@ -32,6 +32,15 @@ export class AdminController {
|
||||
);
|
||||
}
|
||||
|
||||
@Get('verification-icons')
|
||||
@ApiOperation({ summary: 'Список значков верификации', description: 'Доступные значки для выбора при верификации пользователя.' })
|
||||
listVerificationIcons(@CurrentAdmin() admin: AdminRequestUser) {
|
||||
if (!admin.canVerifyUsers) {
|
||||
throw new ForbiddenException('Недостаточно прав для верификации пользователей');
|
||||
}
|
||||
return this.core.admin.ListVerificationIcons({});
|
||||
}
|
||||
|
||||
@Patch(':userId')
|
||||
@ApiOperation({ summary: 'Обновить профиль пользователя', description: 'Обновляет основные и резервные контакты пользователя.' })
|
||||
@ApiParam({ name: 'userId', description: 'ID пользователя' })
|
||||
@@ -66,4 +75,20 @@ export class AdminController {
|
||||
setSuperAdmin(@Param('userId') userId: string, @Body() dto: SetSuperAdminDto, @CurrentAdmin() admin: AdminRequestUser) {
|
||||
return this.core.admin.SetSuperAdmin({ actorUserId: admin.id, userId, isSuperAdmin: dto.isSuperAdmin });
|
||||
}
|
||||
|
||||
@Patch(':userId/verification')
|
||||
@ApiOperation({ summary: 'Верифицировать или снять верификацию', description: 'Требуется право users.verify.' })
|
||||
@ApiParam({ name: 'userId', description: 'ID пользователя' })
|
||||
@ApiBody({ type: SetUserVerificationDto })
|
||||
setUserVerification(@Param('userId') userId: string, @Body() dto: SetUserVerificationDto, @CurrentAdmin() admin: AdminRequestUser) {
|
||||
if (!admin.canVerifyUsers) {
|
||||
throw new ForbiddenException('Недостаточно прав для верификации пользователей');
|
||||
}
|
||||
return this.core.admin.SetUserVerification({
|
||||
actorUserId: admin.id,
|
||||
userId,
|
||||
isVerified: dto.isVerified,
|
||||
verificationIcon: dto.verificationIcon
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user