Phase 3a backend API for point-of-sale. Includes:
Schema (packages/backend/src/db/schema/pos.ts):
- pgEnums: transaction_type, transaction_status, payment_method,
discount_type, discount_applies_to, drawer_status
- Tables: transaction, transaction_line_item, discount,
discount_audit, drawer_session
- Transaction links to accounts, repair_tickets, repair_batches
- Line items link to products and inventory_units
Tax system:
- tax_rate + service_tax_rate columns on location
- tax_category enum (goods/service/exempt) on product
- Tax resolves per line item: goods→tax_rate, service→service_tax_rate,
exempt→0. Repair line items map: part→goods, labor→service
- GET /tax/lookup/:zip stubbed for future API integration (TAX_API_KEY)
Services (export const pattern, matching existing codebase):
- TransactionService: create, addLineItem, removeLineItem, applyDiscount,
recalculateTotals, complete (decrements inventory), void, getReceipt
- DiscountService: CRUD + listAll for dropdowns
- DrawerService: open/close with expected balance + over/short calc
- TaxService: getRateForLocation (by tax category), calculateTax
Routes:
- POST/GET /transactions, GET /transactions/:id, GET /transactions/:id/receipt
- POST /transactions/:id/line-items, DELETE /transactions/:id/line-items/:id
- POST /transactions/:id/discounts, /complete, /void
- POST /drawer/open, POST /drawer/:id/close, GET /drawer/current, GET /drawer
- CRUD /discounts + GET /discounts/all
- GET /products/lookup/upc/:upc (barcode scanner support)
All routes gated by pos.view/pos.edit/pos.admin + withModule('pos').
POS module already seeded in migration 0026.
Still needed: bun install, drizzle-kit generate + migrate, tests, lint.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
194 lines
4.8 KiB
TypeScript
194 lines
4.8 KiB
TypeScript
export { PaginationSchema } from './pagination.schema.js'
|
|
export type { PaginationInput, PaginatedResponse } from './pagination.schema.js'
|
|
|
|
export { UserRole, RegisterSchema, LoginSchema } from './auth.schema.js'
|
|
export type { RegisterInput, LoginInput } from './auth.schema.js'
|
|
|
|
export {
|
|
BillingMode,
|
|
PaymentProcessor,
|
|
TaxExemptStatus,
|
|
AccountCreateSchema,
|
|
AccountUpdateSchema,
|
|
MemberCreateSchema,
|
|
MemberUpdateSchema,
|
|
AccountSearchSchema,
|
|
MemberIdentifierCreateSchema,
|
|
MemberIdentifierUpdateSchema,
|
|
ProcessorLinkCreateSchema,
|
|
ProcessorLinkUpdateSchema,
|
|
PaymentMethodCreateSchema,
|
|
PaymentMethodUpdateSchema,
|
|
TaxExemptionCreateSchema,
|
|
TaxExemptionUpdateSchema,
|
|
LookupCreateSchema,
|
|
LookupUpdateSchema,
|
|
} from './account.schema.js'
|
|
export type {
|
|
AccountCreateInput,
|
|
AccountUpdateInput,
|
|
MemberCreateInput,
|
|
MemberUpdateInput,
|
|
MemberIdentifierCreateInput,
|
|
MemberIdentifierUpdateInput,
|
|
ProcessorLinkCreateInput,
|
|
ProcessorLinkUpdateInput,
|
|
PaymentMethodCreateInput,
|
|
PaymentMethodUpdateInput,
|
|
TaxExemptionCreateInput,
|
|
TaxExemptionUpdateInput,
|
|
LookupCreateInput,
|
|
LookupUpdateInput,
|
|
} from './account.schema.js'
|
|
|
|
export {
|
|
CategoryCreateSchema,
|
|
CategoryUpdateSchema,
|
|
SupplierCreateSchema,
|
|
SupplierUpdateSchema,
|
|
ItemCondition,
|
|
UnitStatus,
|
|
SystemItemCondition,
|
|
SystemUnitStatus,
|
|
ProductCreateSchema,
|
|
ProductUpdateSchema,
|
|
ProductSearchSchema,
|
|
InventoryUnitCreateSchema,
|
|
InventoryUnitUpdateSchema,
|
|
ProductSupplierCreateSchema,
|
|
ProductSupplierUpdateSchema,
|
|
StockReceiptCreateSchema,
|
|
} from './inventory.schema.js'
|
|
export type {
|
|
CategoryCreateInput,
|
|
CategoryUpdateInput,
|
|
SupplierCreateInput,
|
|
SupplierUpdateInput,
|
|
ProductCreateInput,
|
|
ProductUpdateInput,
|
|
InventoryUnitCreateInput,
|
|
InventoryUnitUpdateInput,
|
|
ProductSupplierCreateInput,
|
|
ProductSupplierUpdateInput,
|
|
StockReceiptCreateInput,
|
|
} from './inventory.schema.js'
|
|
|
|
export {
|
|
RepairTicketStatus,
|
|
RepairLineItemType,
|
|
RepairConditionIn,
|
|
RepairBatchStatus,
|
|
RepairBatchApproval,
|
|
RepairTicketCreateSchema,
|
|
RepairTicketUpdateSchema,
|
|
RepairTicketStatusUpdateSchema,
|
|
RepairLineItemCreateSchema,
|
|
RepairLineItemUpdateSchema,
|
|
RepairBatchCreateSchema,
|
|
RepairBatchUpdateSchema,
|
|
RepairBatchStatusUpdateSchema,
|
|
RepairNoteVisibility,
|
|
RepairNoteCreateSchema,
|
|
RepairServiceTemplateCreateSchema,
|
|
RepairServiceTemplateUpdateSchema,
|
|
} from './repairs.schema.js'
|
|
export type {
|
|
RepairTicketCreateInput,
|
|
RepairTicketUpdateInput,
|
|
RepairTicketStatusUpdateInput,
|
|
RepairLineItemCreateInput,
|
|
RepairLineItemUpdateInput,
|
|
RepairBatchCreateInput,
|
|
RepairBatchUpdateInput,
|
|
RepairBatchStatusUpdateInput,
|
|
RepairNoteCreateInput,
|
|
RepairServiceTemplateCreateInput,
|
|
RepairServiceTemplateUpdateInput,
|
|
} from './repairs.schema.js'
|
|
|
|
export {
|
|
LessonFormat,
|
|
InstructorCreateSchema,
|
|
InstructorUpdateSchema,
|
|
LessonTypeCreateSchema,
|
|
LessonTypeUpdateSchema,
|
|
ScheduleSlotCreateSchema,
|
|
ScheduleSlotUpdateSchema,
|
|
EnrollmentStatus,
|
|
EnrollmentCreateSchema,
|
|
EnrollmentUpdateSchema,
|
|
EnrollmentStatusUpdateSchema,
|
|
LessonSessionStatus,
|
|
LessonSessionStatusUpdateSchema,
|
|
LessonSessionNotesSchema,
|
|
LessonSessionUpdateSchema,
|
|
GradingScaleCreateSchema,
|
|
GradingScaleUpdateSchema,
|
|
LessonPlanItemStatus,
|
|
LessonPlanCreateSchema,
|
|
LessonPlanUpdateSchema,
|
|
LessonPlanItemUpdateSchema,
|
|
InstructorBlockedDateCreateSchema,
|
|
StoreClosureCreateSchema,
|
|
GradeCreateSchema,
|
|
SessionPlanItemsSchema,
|
|
SkillLevel,
|
|
LessonPlanTemplateCreateSchema,
|
|
LessonPlanTemplateUpdateSchema,
|
|
TemplateInstantiateSchema,
|
|
} from './lessons.schema.js'
|
|
export type {
|
|
InstructorCreateInput,
|
|
InstructorUpdateInput,
|
|
LessonTypeCreateInput,
|
|
LessonTypeUpdateInput,
|
|
ScheduleSlotCreateInput,
|
|
ScheduleSlotUpdateInput,
|
|
EnrollmentCreateInput,
|
|
EnrollmentUpdateInput,
|
|
EnrollmentStatusUpdateInput,
|
|
LessonSessionStatusUpdateInput,
|
|
LessonSessionNotesInput,
|
|
LessonSessionUpdateInput,
|
|
GradingScaleCreateInput,
|
|
GradingScaleUpdateInput,
|
|
LessonPlanCreateInput,
|
|
LessonPlanUpdateInput,
|
|
LessonPlanItemUpdateInput,
|
|
InstructorBlockedDateCreateInput,
|
|
StoreClosureCreateInput,
|
|
GradeCreateInput,
|
|
SessionPlanItemsInput,
|
|
LessonPlanTemplateCreateInput,
|
|
LessonPlanTemplateUpdateInput,
|
|
TemplateInstantiateInput,
|
|
} from './lessons.schema.js'
|
|
|
|
export {
|
|
TransactionType,
|
|
TransactionStatus,
|
|
PaymentMethod,
|
|
DiscountType,
|
|
DiscountAppliesTo,
|
|
DrawerStatus,
|
|
TaxCategory,
|
|
TransactionCreateSchema,
|
|
TransactionLineItemCreateSchema,
|
|
ApplyDiscountSchema,
|
|
CompleteTransactionSchema,
|
|
DiscountCreateSchema,
|
|
DiscountUpdateSchema,
|
|
DrawerOpenSchema,
|
|
DrawerCloseSchema,
|
|
} from './pos.schema.js'
|
|
export type {
|
|
TransactionCreateInput,
|
|
TransactionLineItemCreateInput,
|
|
ApplyDiscountInput,
|
|
CompleteTransactionInput,
|
|
DiscountCreateInput,
|
|
DiscountUpdateInput,
|
|
DrawerOpenInput,
|
|
DrawerCloseInput,
|
|
} from './pos.schema.js'
|