From d24140742446158927ac1fe64035c05d82620109 Mon Sep 17 00:00:00 2001 From: WangDL Date: Sun, 24 May 2026 18:56:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20M4=20audit=20=E2=80=94=20add=20DELETE=20?= =?UTF-8?q?decisions,=20PATCH=20user-agreements,=20regular=20user=20list?= =?UTF-8?q?=20endpoint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- src/modules/compliance/compliance.controller.ts | 7 +++++++ src/modules/release/release.controller.ts | 7 +++++++ .../users/admin-users-mgmt.controller.ts | 17 +++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/modules/compliance/compliance.controller.ts b/src/modules/compliance/compliance.controller.ts index 7f7083a..812a537 100644 --- a/src/modules/compliance/compliance.controller.ts +++ b/src/modules/compliance/compliance.controller.ts @@ -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) { + if (dto.effectiveAt) dto.effectiveAt = new Date(dto.effectiveAt); + return this.prisma.userAgreement.update({ where: { id }, data: dto }); + } + // ═══ Filing Records ═══ @Get('filings') diff --git a/src/modules/release/release.controller.ts b/src/modules/release/release.controller.ts index 106285d..24d1abb 100644 --- a/src/modules/release/release.controller.ts +++ b/src/modules/release/release.controller.ts @@ -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') diff --git a/src/modules/users/admin-users-mgmt.controller.ts b/src/modules/users/admin-users-mgmt.controller.ts index a77979b..3b4c906 100644 --- a/src/modules/users/admin-users-mgmt.controller.ts +++ b/src/modules/users/admin-users-mgmt.controller.ts @@ -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')