feat(api): add xmlOriginal to getCfdiById and add getXmlById
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,7 @@ export async function getCfdiById(schema: string, id: string): Promise<Cfdi | nu
|
|||||||
tipo_cambio as "tipoCambio", metodo_pago as "metodoPago",
|
tipo_cambio as "tipoCambio", metodo_pago as "metodoPago",
|
||||||
forma_pago as "formaPago", uso_cfdi as "usoCfdi",
|
forma_pago as "formaPago", uso_cfdi as "usoCfdi",
|
||||||
estado, xml_url as "xmlUrl", pdf_url as "pdfUrl",
|
estado, xml_url as "xmlUrl", pdf_url as "pdfUrl",
|
||||||
|
xml_original as "xmlOriginal",
|
||||||
created_at as "createdAt"
|
created_at as "createdAt"
|
||||||
FROM "${schema}".cfdis
|
FROM "${schema}".cfdis
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
@@ -94,6 +95,14 @@ export async function getCfdiById(schema: string, id: string): Promise<Cfdi | nu
|
|||||||
return result[0] || null;
|
return result[0] || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
`, id);
|
||||||
|
|
||||||
|
return result[0]?.xml_original || null;
|
||||||
|
}
|
||||||
|
|
||||||
export interface CreateCfdiData {
|
export interface CreateCfdiData {
|
||||||
uuidFiscal: string;
|
uuidFiscal: string;
|
||||||
tipo: 'ingreso' | 'egreso' | 'traslado' | 'nomina' | 'pago';
|
tipo: 'ingreso' | 'egreso' | 'traslado' | 'nomina' | 'pago';
|
||||||
|
|||||||
Reference in New Issue
Block a user