feat: wire admin workflows to real APIs
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user