Commit Graph

622 Commits

Author SHA1 Message Date
Ho Ngoc Hai
9aa4b1b3cf docs: update ROADMAP.md — Phase 1 complete (7/8 P0 done)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:56:29 +07:00
Ho Ngoc Hai
1d12a7980b feat: add order lifecycle integration tests (29 tests) and staging K8s deployment manifests
Testing (P0-7):
- 29 functional tests for order-service API (create/pay/complete/cancel lifecycle)
- CustomWebApplicationFactory with InMemory DB, mocked wallet/SignalR/tenant
- TestAuthHandler for JWT auth in tests
- Full lifecycle tests: cash flow and online payment flow end-to-end

Staging Deployment (P0-8):
- K8s manifests for 8 MVP services + Redis + POS web (namespace, configmap, secrets)
- Traefik Ingress with path-based routing and TLS via cert-manager
- HPA auto-scaling (2-4 replicas, CPU/memory thresholds)
- deploy-staging.sh script with --dry-run and --service flags
- CI/CD: deploy-staging.yml and docker-build.yml with matrix strategy
- Consistent patterns: port 8080, 3 health probes, RollingUpdate

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:56:03 +07:00
Ho Ngoc Hai
914dda3fe9 docs: update ROADMAP.md with RLS and FnB tests completion
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:41:18 +07:00
Ho Ngoc Hai
6061164873 feat: add multi-tenant row-level security across 5 services and 96 FnB engine unit tests
Security (P0-5):
- Implement ITenantProvider + HttpContextTenantProvider per service (order, fnb, inventory, catalog, wallet)
- Add EF Core global query filters for tenant isolation (shop_id/user_id based)
- Add TenantMiddleware setting PostgreSQL session variables for RLS
- Create PostgreSQL RLS policies script (scripts/db/rls-policies.sql)
- Adapter pattern bridges API-layer to Infrastructure-layer (Clean Architecture)
- Bypass mechanisms for admin roles, service-to-service calls, and migrations

Testing (P1-12):
- Add 96 unit tests for fnb-engine (up from 3)
- 57 domain entity tests: Table(18), KitchenTicket(12), Session(8), Reservation(13), Recipe(6)
- 39 command handler tests: CRUD operations, status transitions, validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:40:34 +07:00
Ho Ngoc Hai
8af86e9e89 feat: implement Phase 1 payment gateway, real-time SignalR, kitchen-inventory deduction, and order payment flow
- wallet-service: IPaymentGateway abstraction + VN Pay implementation (HMAC-SHA512, sandbox), Payment aggregate root, PaymentsController with create/callback/query endpoints
- order-service: PosHub SignalR hub with Redis backplane + MessagePack, strongly-typed clients, 3 group types (shop/kds/pos), integrated into Create/Pay/Complete/Cancel order handlers
- fnb-engine + inventory-service: Kitchen→Inventory auto-deduction via domain events, HTTP with Polly retry + circuit breaker, idempotency check, graceful degradation on insufficient stock
- order-service: Enhanced PayOrderCommand with 3 flows (cash/card/online), PaymentPending status, WalletServiceClient, CompleteOrderPaymentCommand for gateway callbacks
- POS frontend: Cash/Card/QR payment components wired to real backend, BFF proxy updated
- infra: Traefik routes for fnb-engine, inventory-service, and SignalR WebSocket hub
- ROADMAP.md: Updated with Phase 1 progress tracking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:28:46 +07:00
Ho Ngoc Hai
5d9a41fde9 feat(docs): add comprehensive platform roadmap and development tracker 2026-03-06 12:55:25 +07:00
Ho Ngoc Hai
2e1bb65bd3 feat: implement merchant subscription management and enhanced user account/security features with a new BFF layer. 2026-03-06 12:34:53 +07:00
Ho Ngoc Hai
193b9edd23 feat(staff): Integrate kitchen display system, add new staff roles, and enhance staff profile resolution with improved attendance proxying. 2026-03-06 11:42:41 +07:00
Ho Ngoc Hai
30b3f9a37c feat(staff-portal): implement staff attendance and leave request management with dedicated portal UI and backend services 2026-03-06 04:29:00 +07:00
Ho Ngoc Hai
a51ecacfac feat(shop-recipes): add product linking, ingredient display, and edit functionality for recipes. 2026-03-06 03:29:28 +07:00
Ho Ngoc Hai
fd75da34dc feat: enhance inventory management with new item types, stocktake, wastage, and recipe-based deductions 2026-03-05 22:28:45 +07:00
Ho Ngoc Hai
6d5d4108c7 refactor(api, web-client): remove API versioning from services and update client calls, and enhance staff schedule management in the admin UI to support multiple days and shift presets. 2026-03-05 16:40:02 +07:00
Ho Ngoc Hai
3f1ecc8122 feat(booking-service, web-client-tpos): implement staff schedule creation/deletion and enhance staff name display. 2026-03-05 16:19:46 +07:00
Ho Ngoc Hai
81c5be9e37 fix(staff): Vấn đề trạng thái nhân viên "Invited" 2026-03-05 15:56:37 +07:00
Ho Ngoc Hai
e4bedf2cd3 feat(allPos): upgrad frontend 2026-03-05 15:33:23 +07:00
Ho Ngoc Hai
1fb1a5c52c feat(claude): establish detailed agent role definitions and comprehensive project context 2026-03-05 14:30:06 +07:00
Ho Ngoc Hai
91a219d65f feat: implement hourly rates for tables/rooms, add shop publishing, and introduce system health checks. 2026-03-05 12:09:28 +07:00
Ho Ngoc Hai
c70248fdec feat(karaoke-pos): integrate session management and F&B ordering with backend APIs across the workflow pages. 2026-03-05 11:15:46 +07:00
Ho Ngoc Hai
e748c43b22 feat(shop-admin): add happy hour and promotion configuration UI and enhance room management with add/edit/delete functionality. 2026-03-05 08:44:47 +07:00
Ho Ngoc Hai
cd979970e7 feat(fnb, tpos): implement table QR code scanning for customer menu and reservation management 2026-03-05 08:28:32 +07:00
Ho Ngoc Hai
cfcdbd069d feat(pos): implement order payment flow and update order aggregate status handling. 2026-03-05 08:05:19 +07:00
Ho Ngoc Hai
0901e91673 feat(pos): implement table-based ordering, kitchen ticket workflow, and table floor plan management 2026-03-05 07:53:00 +07:00
Ho Ngoc Hai
7102b89ef1 refactor(web-client-tpos): extract shop admin sections into dedicated Blazor components and centralize helpers 2026-03-05 07:16:16 +07:00
Ho Ngoc Hai
802c03995a feat(order-processing): execute order item strategies during order creation and add kitchen ticket API with session management. 2026-03-05 06:19:18 +07:00
Ho Ngoc Hai
926d4ee83c feat(tpos-client): implement send to kitchen workflow, table reservations, and enhanced admin zone management. 2026-03-05 06:00:21 +07:00
Ho Ngoc Hai
a4f4c4755e feat(fnb-reservation): implement reservation management with API, infrastructure, and TPOS client UI. 2026-03-05 05:39:02 +07:00
Ho Ngoc Hai
c0301a22e5 feat(pos): Display empty state messages for resource grids and implement shop-specific staff management in POS views. 2026-03-05 05:03:28 +07:00
Ho Ngoc Hai
88cd45c3a8 feat(pos-cafe): implement payment method settings, add detailed order history view, and update payment icons to Lucide 2026-03-05 04:40:06 +07:00
Ho Ngoc Hai
b041ba5449 feat(web-client-tpos): integrate StorageService API and adapt client data handling while removing multi-vertical architecture plan documentation. 2026-03-05 04:25:53 +07:00
Ho Ngoc Hai
14f6ddea77 feat(web-client-tpos): implement shop storage management and enhance revenue charts with membership level improvements 2026-03-05 04:16:49 +07:00
Ho Ngoc Hai
c86500214b feat: implement category CRUD with image upload, extend staff profile fields, and add membership level/EXP management 2026-03-05 03:03:48 +07:00
Ho Ngoc Hai
4d6c9c6ba3 feat: enhance error handling for staff and member creation, update IAM token lifetime, and refine staff query enumeration. 2026-03-05 02:10:52 +07:00
Ho Ngoc Hai
629fed8a55 commit 2026-03-05 01:39:40 +07:00
Ho Ngoc Hai
df7eec1ec2 feat(web-client-tpos, inventory-service): implement percentage-based campaigns and enrich inventory with product names 2026-03-04 20:22:54 +07:00
Ho Ngoc Hai
051261accd feat: implement recipe management, inventory operations, voucher integration, and order discounts 2026-03-04 20:05:38 +07:00
Ho Ngoc Hai
65f3da53ae refactor(merchant-service): standardize enumeration name resolution in shop queries using a new helper method. 2026-03-04 16:11:55 +07:00
Ho Ngoc Hai
028ef4c1cd feat: implement user-based wallet and transaction retrieval by parsing JWT sub claim and adjust JWT validation parameters across services. 2026-03-04 13:08:08 +07:00
Ho Ngoc Hai
7baba14fad refactor(web-client-tpos, order-service): improve API deserialization, update DTO types for Dapper compatibility, and refine API proxying for staff schedules and order cancellations. 2026-03-04 12:53:43 +07:00
Ho Ngoc Hai
64e7b4e00d refactor: update EF Core backing field mapping and ignore DDD enumeration types 2026-03-04 12:36:19 +07:00
Ho Ngoc Hai
2d74f53f0d refactor: update DTO numeric types, refactor EF Core entity configurations to use HasField, and enable JsonDocument change tracking. 2026-03-04 11:44:43 +07:00
Ho Ngoc Hai
89bd8232a8 feat: Implement Blazor lifecycle improvements, enhance navigation with browser history, and update EF Core entity configurations for backing fields 2026-03-04 11:35:41 +07:00
Ho Ngoc Hai
ba11317293 refactor(web-client-tpos): unify JSON serialization for API client, streamline authentication flows, and update UI layouts and navigation. 2026-03-04 11:21:22 +07:00
Ho Ngoc Hai
ce61b4d3db feat(fnb-engine): add shopId and status filters to kitchen tickets
Add shopId and status query params to GET /api/v1/kitchen/tickets.
Joins through Session to resolve shopId since KitchenTicket only
has SessionId. Backward-compatible: without shopId falls back to
existing pending-by-station behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 10:37:55 +07:00
Ho Ngoc Hai
4cd172bee5 feat(booking-service): add shop-wide staff schedules endpoint
Add GET /api/v1/schedules?shopId= to return all staff schedules
for a shop. Existing per-staff endpoint unchanged. BFF needs this
to display all schedules on the admin dashboard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 10:36:43 +07:00
Ho Ngoc Hai
9b44e88a6a feat(order-service): add dashboard and reporting endpoints
- GET /api/v1/orders/dashboard — POS dashboard stats (revenue, orders,
  items sold, popular items, payment breakdown, hourly revenue, recent orders)
- GET /api/v1/reports/revenue — Revenue report grouped by daily/weekly/monthly
- GET /api/v1/reports/top-products — Top selling products by quantity

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 10:36:09 +07:00
Ho Ngoc Hai
37042b48b7 feat(inventory-service): add shopId filter to transactions endpoint
BFF needs to query inventory transactions by shopId. The existing
endpoint only supported inventoryItemId. Now accepts either shopId
or inventoryItemId as query parameters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 10:35:54 +07:00
Ho Ngoc Hai
4a1094b080 fix(web-client-tpos): restore JWT from localStorage before admin API calls
Root cause: AdminBase had no auth initialization. AuthStateService is
in-memory Singleton — token is null after page refresh. Admin pages
called PosDataService without token → BFF forwarded requests without
Authorization header → microservices returned 401.

Fix:
- AdminBase.cs: inject AuthService, call TryRestoreSessionAsync()
- 9 admin pages: add await base.OnInitializedAsync() calls
- BffHttpClient.cs: add debug logging for auth forwarding
2026-03-04 10:27:56 +07:00
Ho Ngoc Hai
710f87a94d chore(docker): replace BFF direct DB vars with microservice HTTP proxy URLs
- Remove BFF_DB_HOST/PORT/USER/PASS env vars (no more direct DB access)
- Add 9 {ServiceName}__BaseUrl env vars for HTTP proxy pattern
- BFF now communicates via internal Docker network to microservices
2026-03-04 10:13:42 +07:00
Ho Ngoc Hai
9be3450ab9 refactor(web-client-tpos): convert BFF from direct DB to HTTP proxy
- Replace Dapper/Npgsql direct DB access with HttpClient proxy to microservice APIs
- Create BffHttpClient.cs with AuthForwardingHandler (forwards JWT tokens)
- Register 9 named HttpClients: Merchant, Catalog, Order, Inventory, Membership, Wallet, Promotion, Booking, FnbEngine
- Delete BffDbConnectionFactory.cs and TenantContext.cs (no more direct DB)
- Remove Dapper and Npgsql package references from .csproj
- All 10 controllers are now thin HTTP proxy bridges
- Zero breaking changes: all api/bff/ routes preserved
2026-03-04 10:13:28 +07:00
Ho Ngoc Hai
0a5e1a9271 refactor(web-client-tpos): split monolithic BffDataController into 10 module controllers
- Extract shared infrastructure: BffDbConnectionFactory, TenantContext (per-request cache)
- Extract 19 DTOs to Models/BffDtos.cs
- Create 10 controllers: Shop, Catalog, Staff, Order, Inventory, Financial, Booking, Fnb, Reports, Membership
- Register DI services in Program.cs
- Delete monolithic BffDataController.cs (1831 lines)
- All API routes preserved under api/bff prefix (zero breaking changes)
2026-03-04 09:36:57 +07:00