fix(api): add UUID type cast in getCfdiById and getXmlById
PostgreSQL requires explicit type cast when comparing UUID columns with text parameters in raw queries. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -89,7 +89,7 @@ export async function getCfdiById(schema: string, id: string): Promise<Cfdi | nu
|
||||
xml_original as "xmlOriginal",
|
||||
created_at as "createdAt"
|
||||
FROM "${schema}".cfdis
|
||||
WHERE id = $1
|
||||
WHERE id = $1::uuid
|
||||
`, id);
|
||||
|
||||
return result[0] || null;
|
||||
@@ -97,7 +97,7 @@ export async function getCfdiById(schema: string, id: string): Promise<Cfdi | nu
|
||||
|
||||
export async function getXmlById(schema: string, id: string): Promise<string | null> {
|
||||
const result = await prisma.$queryRawUnsafe<[{ xml_original: string | null }]>(`
|
||||
SELECT xml_original FROM "${schema}".cfdis WHERE id = $1
|
||||
SELECT xml_original FROM "${schema}".cfdis WHERE id = $1::uuid
|
||||
`, id);
|
||||
|
||||
return result[0]?.xml_original || null;
|
||||
|
||||
Reference in New Issue
Block a user