feat(invoices): add public invoices module with controller and service

refactor: remove unused trigger logs module and related files
refactor: simplify good snapshot handling in sale invoice creation
This commit is contained in:
2026-05-21 21:35:36 +03:30
parent 9aa12184a1
commit 2dc9480170
13 changed files with 180 additions and 86 deletions
-8
View File
@@ -98,14 +98,6 @@ export const select: SalesInvoiceSelect = {
notes: true,
payload: true,
good_snapshot: true,
good: {
select: {
name: true,
barcode: true,
image_url: true,
category: true,
},
},
},
},
payments: {
@@ -411,11 +411,7 @@ export class SharedSaleInvoiceCreateService {
sku_vat: goodsById.get(item.good_id!)?.sku.VAT || null,
payload: item.payload ? JSON.parse(JSON.stringify(item.payload)) : undefined,
good_snapshot: item.good_id
? JSON.parse(
JSON.stringify({
good: goodsById.get(item.good_id) || null,
}),
)
? JSON.parse(JSON.stringify(goodsById.get(item.good_id) || null))
: undefined,
})),
},
+3
View File
@@ -3,6 +3,7 @@ import { EnumKeyMaker } from './enum'
import { GuildKeyMaker } from './guild'
import { PartnerKeyMaker } from './partner'
import { PosKeyMaker } from './pos'
import { PublicSaleInvoiceKeyMaker } from './publicSaleInvoice'
// Keep backward-compatible static methods while separating key builders by domain.
export class RedisKeyMaker extends PartnerKeyMaker {
@@ -25,6 +26,8 @@ export class RedisKeyMaker extends PartnerKeyMaker {
static enumsAll = EnumKeyMaker.enumsAll
static enumsValues = EnumKeyMaker.enumsValues
static publicSaleInvoice = PublicSaleInvoiceKeyMaker.invoice
}
export { ConsumerKeyMaker, EnumKeyMaker, GuildKeyMaker, PartnerKeyMaker, PosKeyMaker }
@@ -0,0 +1,5 @@
export class PublicSaleInvoiceKeyMaker {
static invoice(id: string): string {
return `publicSaleInvoices:${id}`
}
}