feat: 简化小程序上传入口

This commit is contained in:
que01 committed 2026-10-13 17:58:57 +08:00
1 parent d5a84b51a7
commit ad949ab370
4 files changed
+29 -66

No files matched your search

@@ -47,6 +47,16 @@ export class AdminMiniAppReleaseController {
private readonly prisma: PrismaService,
) {}
@Get("latest")
async latest(@Req() request: FastifyRequest): Promise<unknown> {
const identity = await this.identity(request);
const task = await this.prisma.miniAppReleaseTask.findFirst({
where: { brandId: identity.brandId },
orderBy: { createdAt: "desc" },
});
return task ?? null;
}
@Get("settings")
async settings(@Req() request: FastifyRequest): Promise<unknown> {
const identity = await this.identity(request);
@@ -129,7 +139,8 @@ export class AdminMiniAppReleaseController {
where: { id: taskId, brandId: identity.brandId },
});
if (!task) throw new BadRequestException("小程序发布任务不存在");
if (task.status !== "built") throw new BadRequestException("当前小程序发布任务不能重复上传");
if (task.status !== "built" && task.status !== "failed")
throw new BadRequestException("当前小程序发布任务不能重复上传");
const brand = await this.prisma.brandProfile.findUniqueOrThrow({
where: { id: identity.brandId },
select: { miniAppSettings: true },