feat: wire admin workflows to real APIs

This commit is contained in:
hectorzhao
2026-07-02 13:50:09 +08:00
parent f8c9b78c21
commit ab421cf8a7
42 changed files with 2596 additions and 250 deletions
+22 -4
View File
@@ -20,16 +20,34 @@ export interface ReviewCertificationDto {
export class CertificationService {
constructor(private readonly prisma: PrismaService) {}
list(tenantId?: string, status?: string) {
list(tenantId?: string, status?: string, keyword?: string) {
return this.prisma.enterpriseCertification.findMany({
where: { tenantId, status },
where: {
tenantId,
status: status && status !== 'all' ? status : undefined,
OR: keyword ? [
{ companyName: { contains: keyword } },
{ licenseNo: { contains: keyword } },
{ contactName: { contains: keyword } },
{ contactPhone: { contains: keyword } },
{ tenant: { name: { contains: keyword } } },
] : undefined,
},
include: { tenant: true },
orderBy: { createdAt: 'desc' },
take: 100,
});
}
get(id: string) {
return this.prisma.enterpriseCertification.findUnique({ where: { id } });
async get(id: string) {
const certification = await this.prisma.enterpriseCertification.findUnique({
where: { id },
include: { tenant: true },
});
if (!certification) {
throw new NotFoundException('Enterprise certification not found');
}
return certification;
}
async submit(data: SubmitCertificationDto) {