fix: M4 audit — add DELETE decisions, PATCH user-agreements, regular user list endpoint
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 44s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
WangDL 2026-05-24 18:56:54 +08:00
parent c6d01534c8
commit d241407424
3 changed files with 31 additions and 0 deletions

View File

@ -45,6 +45,13 @@ export class ComplianceController {
return this.prisma.userAgreement.create({ data: { ...dto, effectiveAt: new Date(dto.effectiveAt) } });
}
@Patch('user-agreements/:id')
@ApiOperation({ summary: '更新用户协议' })
async updateUserAgreement(@Param('id') id: string, @Body() dto: Record<string, any>) {
if (dto.effectiveAt) dto.effectiveAt = new Date(dto.effectiveAt);
return this.prisma.userAgreement.update({ where: { id }, data: dto });
}
// ═══ Filing Records ═══
@Get('filings')

View File

@ -58,6 +58,13 @@ export class ReleaseController {
return this.prisma.decisionRecord.update({ where: { id }, data: dto });
}
@Delete('decisions/:id')
@ApiOperation({ summary: '删除决策记录' })
async deleteDecision(@Param('id') id: string) {
await this.prisma.decisionRecord.delete({ where: { id } });
return { ok: true };
}
// ═══ Release Checklist ═══
@Get('checklists/:version')

View File

@ -13,6 +13,23 @@ import type { AdminRole } from '../../common/types/admin-role.enum';
export class AdminUsersMgmtController {
constructor(private readonly prisma: PrismaService) {}
// ── User List ──
@Get()
@AdminRoles('ADMIN' as AdminRole)
@ApiOperation({ summary: 'C 端用户列表' })
async listUsers(@Query('search') search?: string, @Query('page') page?: string, @Query('limit') limit?: string) {
const take = Math.min(Number(limit) || 20, 100);
const skip = (Math.max(Number(page) || 1, 1) - 1) * take;
const where: any = { deletedAt: null };
if (search) where.OR = [{ email: { contains: search } }, { nickname: { contains: search } }];
const [items, total] = await Promise.all([
this.prisma.user.findMany({ where, orderBy: { createdAt: 'desc' }, take, skip, select: { id: true, email: true, nickname: true, role: true, status: true, lastLoginAt: true, createdAt: true } }),
this.prisma.user.count({ where }),
]);
return { items, total };
}
// ── Membership ──
@Get('memberships')