feat: harden platform workflows and UI governance
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { CurrentSessionUserId } from '../auth/current-session-user.decorator';
|
||||
import { RequireRecentAuthentication } from '../auth/require-recent-authentication.decorator';
|
||||
import { TenantId } from '../common/tenant-id.decorator';
|
||||
import { DeleteTargetDto, DeletionGovernanceService, DeletionTargetType } from './deletion-governance.service';
|
||||
|
||||
@ApiTags('deletion-governance')
|
||||
@Controller('admin/deletions')
|
||||
export class AdminDeletionGovernanceController {
|
||||
constructor(private readonly deletions: DeletionGovernanceService) {}
|
||||
|
||||
@Get(':type/:id/preflight')
|
||||
preflight(@Param('type') type: DeletionTargetType, @Param('id') id: string) {
|
||||
return this.deletions.preflight(type, id);
|
||||
}
|
||||
|
||||
@Post(':type/:id')
|
||||
@RequireRecentAuthentication()
|
||||
delete(@Param('type') type: DeletionTargetType, @Param('id') id: string, @Body() body: DeleteTargetDto, @CurrentSessionUserId() operatorId?: string) {
|
||||
return this.deletions.delete(type, id, { ...body, operatorId });
|
||||
}
|
||||
}
|
||||
|
||||
@ApiTags('client-deletion-governance')
|
||||
@Controller('client/deletions')
|
||||
export class ClientDeletionGovernanceController {
|
||||
constructor(private readonly deletions: DeletionGovernanceService) {}
|
||||
|
||||
@Get(':type/:id/preflight')
|
||||
preflight(@Param('type') type: DeletionTargetType, @Param('id') id: string, @TenantId() tenantId?: string) {
|
||||
return this.deletions.preflight(type, id, tenantId);
|
||||
}
|
||||
|
||||
@Post(':type/:id')
|
||||
@RequireRecentAuthentication()
|
||||
delete(@Param('type') type: DeletionTargetType, @Param('id') id: string, @Body() body: DeleteTargetDto, @TenantId() tenantId?: string, @CurrentSessionUserId() operatorId?: string) {
|
||||
return this.deletions.delete(type, id, { ...body, operatorId }, tenantId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user