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
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:
parent
c6d01534c8
commit
d241407424
@ -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')
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user