fix(06): correct clientName in agent notification email
This commit is contained in:
@@ -3,7 +3,7 @@ import { NextRequest, NextResponse } from 'next/server';
|
||||
import { verifySigningToken } from '@/lib/signing/token';
|
||||
import { logAuditEvent } from '@/lib/signing/audit';
|
||||
import { db } from '@/lib/db';
|
||||
import { signingTokens, documents } from '@/lib/db/schema';
|
||||
import { signingTokens, documents, clients } from '@/lib/db/schema';
|
||||
import { eq, isNull, and } from 'drizzle-orm';
|
||||
import path from 'node:path';
|
||||
import { embedSignatureInPdf } from '@/lib/signing/embed-signature';
|
||||
@@ -229,12 +229,13 @@ export async function POST(
|
||||
db.query.documents
|
||||
.findFirst({
|
||||
where: eq(documents.id, payload.documentId),
|
||||
with: { client: { columns: { name: true } } },
|
||||
columns: { name: true },
|
||||
})
|
||||
.then(async (freshDoc) => {
|
||||
try {
|
||||
await sendAgentNotificationEmail({
|
||||
clientName: freshDoc?.name ?? 'Client',
|
||||
clientName: (freshDoc as { client?: { name: string } } & typeof freshDoc)?.client?.name ?? 'Client',
|
||||
documentName: freshDoc?.name ?? doc.name,
|
||||
signedAt: now,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user