40 lines
2.5 KiB
Markdown
40 lines
2.5 KiB
Markdown
# POS-003 — Implementer evidence
|
|
|
|
## What
|
|
POS module skeleton: domain + repos + application use cases. No routes (POS-004 covers that).
|
|
|
|
## Files
|
|
- `src/modules/pos/domain/errors.ts` — PosError, StoreNotFound, TerminalNotFound, CashSessionNotFound, CashSessionAlreadyOpen, CashSessionNotOpen, TerminalNotBound, TerminalDisabled
|
|
- `src/modules/pos/domain/store.ts` — PosStore, ListStoresOptions
|
|
- `src/modules/pos/domain/terminal.ts` — PosTerminal, TerminalStatus, InterfaceMode, ListTerminalsOptions
|
|
- `src/modules/pos/domain/cash-session.ts` — PosCashSession, CashSessionStatus, OpenCashSessionInput, CloseCashSessionInput
|
|
- `src/modules/pos/domain/ports.ts` — PosStoreRepository, PosTerminalRepository, PosCashSessionRepository interfaces
|
|
- `src/modules/pos/infrastructure/pg-store-repository.ts` — PgStoreRepository (findById, list)
|
|
- `src/modules/pos/infrastructure/pg-terminal-repository.ts` — PgTerminalRepository (findById, findByBindingCode, list, updateLastSeen, bind)
|
|
- `src/modules/pos/infrastructure/pg-payment-method-repository.ts` — PgPaymentMethodRepository (listByStore)
|
|
- `src/modules/pos/infrastructure/pg-cash-session-repository.ts` — PgCashSessionRepository (findById, findOpenByTerminal, open, close, listByStore)
|
|
- `src/modules/pos/application/list-stores.ts` — ListStoresUseCase
|
|
- `src/modules/pos/application/list-terminals.ts` — ListTerminalsUseCase
|
|
- `src/modules/pos/application/get-pos-config.ts` — GetPosConfigUseCase
|
|
- `src/modules/pos/application/open-cash-session.ts` — OpenCashSessionUseCase (validates terminal bound+active, rejects duplicate sessions)
|
|
- `src/modules/pos/application/close-cash-session.ts` — CloseCashSessionUseCase
|
|
- `src/modules/pos/tests/store-repository.test.ts` — 2 tests
|
|
- `src/modules/pos/tests/cash-session.test.ts` — 6 tests
|
|
- `src/app/build-app.ts` — wired POS repos
|
|
|
|
## Verification
|
|
- `npm run build` → 0 TypeScript errors.
|
|
- `npm test -- --run src/modules/pos/tests/` → 8 passed.
|
|
- `check-module-boundaries.mjs src` → 0 NEW violations.
|
|
- `./scripts/verify.sh` → green.
|
|
|
|
## AC traceability
|
|
| AC | Estado | Evidencia |
|
|
|----|--------|-----------|
|
|
| AC1 domain types | ✅ | PosStore, PosTerminal, PosCashSession + errors |
|
|
| AC2 repos | ✅ | 4 Pg*Repository implementations |
|
|
| AC3 use cases | ✅ | 5 use cases (list-stores, list-terminals, get-pos-config, open, close) |
|
|
| AC4 tests | ✅ | 8 unit tests covering core scenarios |
|
|
| AC5 build-app wired | ✅ | POS repos added to build-app.ts |
|
|
| AC6 scope out | ✅ | No routes (POS-004) |
|