This commit is contained in:
lendry
2026-06-25 08:31:36 +03:00
parent 71b270fcb3
commit 933f7fb9e1
22 changed files with 1871 additions and 620 deletions

View File

@@ -115,14 +115,29 @@ export class ProfileController {
@Post('self-delete')
@ApiOperation({
summary: 'Удалить свой профиль',
description: 'Мягко удаляет профиль: помечает аккаунт как удалённый, освобождает логин и контакты для повторной регистрации, сбрасывает роли и завершает все сессии.'
summary: 'Запросить удаление своего профиля',
description:
'Планирует удаление аккаунта через период ожидания ACCOUNT_DELETE_GRACE_DAYS. До истечения срока пользователь может отменить удаление.'
})
@ApiParam({ name: 'userId', description: 'ID пользователя' })
@ApiResponse({ status: 201, description: 'Профиль удалён' })
@ApiResponse({ status: 201, description: 'Удаление запланировано' })
async selfDelete(@Headers('authorization') authorization: string | undefined, @Param('userId') userId: string) {
await this.assertSelfAccess(authorization, userId);
return this.core.profile.SoftDeleteProfile({ userId });
return this.core.profile.RequestAccountDeletion({ userId });
}
@Post('self-delete/cancel')
@ApiOperation({ summary: 'Отменить запланированное удаление профиля' })
async cancelSelfDelete(@Headers('authorization') authorization: string | undefined, @Param('userId') userId: string) {
await this.assertSelfAccess(authorization, userId);
return this.core.profile.CancelAccountDeletion({ userId });
}
@Get('self-delete/status')
@ApiOperation({ summary: 'Статус запланированного удаления профиля' })
async selfDeleteStatus(@Headers('authorization') authorization: string | undefined, @Param('userId') userId: string) {
await this.assertSelfAccess(authorization, userId);
return this.core.profile.GetAccountDeletionStatus({ userId });
}
}