fix: approve imported signature identity fields

This commit is contained in:
hectorzhao
2026-09-04 20:24:08 +08:00
parent 0ec386e674
commit 41962e7a6e
4 changed files with 144 additions and 4 deletions
@@ -13,6 +13,7 @@ import {
mappedCoreValue,
mappedCorePatchValue,
dynamicValues,
signatureIdentityReportValues,
jsonRecord,
hasValue,
normalizeImageExtension,
@@ -390,8 +391,24 @@ export class ReportImportReviewService {
const applicationId = typeof payload.applicationId === 'string' ? payload.applicationId : undefined;
const importedDrainage = jsonRecord(payload.drainageInfo);
const importedReportValues = jsonRecord(importedDrainage.signatureReportValues);
const buildBody = (current?: { drainageInfo: Prisma.JsonValue | null }) => {
const [reportFields, tenant, application] = await Promise.all([
this.smsConfig.getApplicationReportFields(applicationId, 'signature'),
this.prisma.tenant.findUnique({ where: { id: batch.tenantId }, select: { name: true } }),
applicationId
? this.prisma.smsApplication.findUnique({ where: { id: applicationId }, select: { name: true } })
: Promise.resolve(null),
]);
const buildBody = (current?: { drainageInfo: Prisma.JsonValue | null; purpose?: string | null }) => {
const currentDrainage = jsonRecord(current?.drainageInfo);
const purpose = Object.prototype.hasOwnProperty.call(payload, 'purpose')
? String(payload.purpose ?? '')
: current?.purpose;
const identityValues = signatureIdentityReportValues(reportFields, {
signatureName: name,
purpose,
enterpriseName: tenant?.name,
applicationName: application?.name,
});
return {
applicationId,
name,
@@ -402,6 +419,7 @@ export class ReportImportReviewService {
...currentDrainage,
signatureReportValues: {
...jsonRecord(currentDrainage.signatureReportValues),
...identityValues,
...importedReportValues,
},
},