feat: add drawer cash in/out adjustments with balance reconciliation

- New drawer_adjustment table (type: cash_in/cash_out, amount, reason)
- POST/GET /drawer/:id/adjustments endpoints
- Drawer close calculation now includes adjustments: expected = opening + sales + cash_in - cash_out
- DrawerAdjustmentSchema for input validation
- 5 new tests (44 total POS tests passing)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
ryan
2026-04-04 20:24:55 +00:00
parent 2b9e99bbd6
commit c66554f932
8 changed files with 180 additions and 6 deletions

View File

@@ -180,6 +180,7 @@ export {
DiscountUpdateSchema,
DrawerOpenSchema,
DrawerCloseSchema,
DrawerAdjustmentSchema,
} from './pos.schema.js'
export type {
TransactionCreateInput,
@@ -190,6 +191,7 @@ export type {
DiscountUpdateInput,
DrawerOpenInput,
DrawerCloseInput,
DrawerAdjustmentInput,
} from './pos.schema.js'
export { LogLevel, AppConfigUpdateSchema } from './config.schema.js'

View File

@@ -104,6 +104,13 @@ export const DrawerOpenSchema = z.object({
})
export type DrawerOpenInput = z.infer<typeof DrawerOpenSchema>
export const DrawerAdjustmentSchema = z.object({
type: z.enum(['cash_in', 'cash_out']),
amount: z.coerce.number().min(0.01),
reason: z.string().min(1),
})
export type DrawerAdjustmentInput = z.infer<typeof DrawerAdjustmentSchema>
export const DrawerCloseSchema = z.object({
closingBalance: z.coerce.number().min(0),
denominations: z