feat: 标准化响应体

This commit is contained in:
2026-01-11 16:39:59 +08:00
parent cd50716dc6
commit 45047f40aa
26 changed files with 313 additions and 250 deletions

View File

@@ -20,22 +20,28 @@ export class DeploymentController {
where.projectId = projectId;
}
const isPagination = page !== undefined && pageSize !== undefined;
const result = await prisma.deployment.findMany({
where,
take: pageSize,
skip: (page - 1) * pageSize,
take: isPagination ? pageSize : undefined,
skip: isPagination ? (page! - 1) * pageSize! : 0,
orderBy: {
createdAt: 'desc',
},
});
const total = await prisma.deployment.count({ where });
return {
data: result,
page,
pageSize,
total,
};
if (isPagination) {
return {
list: result,
page,
pageSize,
total,
};
}
return result;
}
@Post('')