feat(nas): archive issued-order PDFs to NAS_ORDERS; split NAS_FINANCIALS_PATH into NAS_INVOICES + NAS_ORDERS
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,7 @@ import {
|
||||
updateInvoice,
|
||||
deleteInvoice,
|
||||
} from "../../services/invoices.service";
|
||||
import { nasFinancialsManager } from "../../services/nas-financials-manager";
|
||||
import { nasInvoicesManager } from "../../services/nas-financials-manager";
|
||||
|
||||
export default async function invoicesRoutes(
|
||||
fastify: FastifyInstance,
|
||||
@@ -202,7 +202,7 @@ export default async function invoicesRoutes(
|
||||
|
||||
// Delete PDF from NAS
|
||||
if (existing.invoice_number) {
|
||||
await nasFinancialsManager.cleanIssuedInvoice(existing.invoice_number);
|
||||
await nasInvoicesManager.cleanIssued(existing.invoice_number);
|
||||
}
|
||||
|
||||
await logAudit({
|
||||
@@ -233,7 +233,7 @@ export default async function invoicesRoutes(
|
||||
|
||||
const d = new Date(invoice.issue_date);
|
||||
const relPath = `Vydané/${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, "0")}/${invoice.invoice_number}.pdf`;
|
||||
const file = nasFinancialsManager.readIssuedInvoice(relPath);
|
||||
const file = nasInvoicesManager.readIssued(relPath);
|
||||
if (!file) return error(reply, "PDF soubor nenalezen", 404);
|
||||
|
||||
const safeName = invoice.invoice_number.replace(/[\r\n"]/g, "");
|
||||
|
||||
Reference in New Issue
Block a user