2f2aec61a2
Lay the cross-cutting platform backbone every later phase reads from. Adds the first marketplace EF migration baseline (new `ops` schema) and the mechanisms b2..b15 reuse: typed runtime config, an append-only audit trail, an analytics event log, the holiday/bank-closure calendar, in-app notifications, and the internal support-alert worklist. Schema & migration - New `ops` schema + migration InitialMarketplaceBaseline with 6 tables: PlatformConfigs (IAuditable), AuditLogs (append-only), SystemEvents, IranianHolidays, Notifications, SupportAlerts — with indexes/uniques and FKs to usr.Users. Seeded 12 config keys + 7 sample holidays via HasData. Domain / Application - IAuditable marker + [AuditRedacted] attribute; entities + string-code constant holders (config data_type, holiday type, alert type/severity/status). - Facade contracts: IPlatformConfig, IHolidayCalendar, IAnalyticsSink, IAuditLogger, INotificationService, ISupportAlertService; DTOs + PagedResult<T>; evolved the INotificationDispatcher.Notification record to carry Type + DataJson; Pagination helper. - 14 CQRS commands/queries (+ validators) wiring the endpoints to the facades. Infrastructure - DB-backed facade implementations in Persistence/Services/; real in-app INotificationDispatcher (removes the b0 log stub); notification-retention hosted service (purge is_read=1 AND age>90d). - Extended AuditFieldInterceptor to also append an old/new-diff audit_logs row for every IAuditable change in the same transaction (PII redacted). - Registered all facades + hosted service in AddPersistenceServices; removed the dispatcher registration from AddCrossCuttingSeams. API - 5 controllers: admin PlatformConfig/Holidays/Audit/SupportAlerts ([Authorize(DynamicPermission)]) + current-user Notifications ([Authorize]), all tenant-scoped and paginated. 16 Swagger paths total. Money-correctness & safety rules honoured - Config read at compute time (cached, parsed by data_type), never hardcoded; every config change is audited in the same transaction; audit_logs is append-only (no update/delete path); support alerts are admin-only; notifications are tenant-scoped; analytics is fire-and-forget. Tests & docs - 18 new foundation tests over in-memory SQLite (config typing + audit, holidays, notifications + tenancy + retention, support alerts, analytics); build clean (0 new code warnings), 22 tests green; migration applied to the dev DB and swagger.v1.json refreshed. - Updated server Project map + CONVENTIONS, product data-model doc 12 (seeded config defaults), config-reference contract, mock registry, backend handoff/ STATUS/report. Follow-ups: add FK constraints for SupportAlerts.BookingId (b9) and ReviewId (b14) when those tables land. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5.5 KiB
5.5 KiB
Mock & integration registry
The master list of every external dependency that is mocked behind a DI seam in this build, and the exact steps to make each one real. Backend lane owns this file; every phase that introduces or touches a seam updates its row. This is the checklist the team works through to go from "MVP with mocks" to "production with real providers".
Status legend: 🔴 not built · 🟡 mocked (seam + fake impl in place) · 🟢 real integration live.
| Seam (interface) | Introduced in | What it fakes | Config keys | Make it real → | Status |
|---|---|---|---|---|---|
ISmsSender |
backend-phase-2 | OTP/SMS delivery — logs the code instead of sending | tbd | Implement a Kavenegar/Ghasedak/SMS.ir client; keep idempotency + rate-limit | 🔴 |
IObjectStorage |
backend-phase-0/6 | File storage — local-disk store under a scratch root (LocalDiskObjectStorage, Baya.Infrastructure.CrossCutting/Seams/) |
Seams:ObjectStorage:RootPath (default: temp dir) |
Point at MinIO/S3/ArvanCloud; presigned upload/download; bucket + creds | 🟡 |
ICacheService |
backend-phase-0 | Caching — in-memory IMemoryCache (MemoryCacheService, Baya.Infrastructure.CrossCutting/Seams/) |
none | Swap to Redis (StackExchange.Redis); keep key/TTL scheme |
🟡 |
IDistributedLock |
backend-phase-10 | Money-path locks — no-op/in-proc | tbd | Redis lock (RedLock); DB constraint remains the backstop | 🔴 |
INurseSearch |
backend-phase-7 | Search — SQL over nurse_search_index |
tbd | Elasticsearch index + feeder; reimplement the interface | 🔴 |
IPaymentProvider |
backend-phase-10 | Card PSP/IPG — deterministic success | tbd | ZarinPal/Sadad/Vandar/Jibit + Shaparak; merchant/terminal/تسهیم | 🔴 |
ISettlementSplitProvider |
backend-phase-10 | تسهیم split — accepts any balanced legs | tbd | Provider split-by-ratio to registered Shebas | 🔴 |
IWebhookVerifier |
backend-phase-10 | Callback auth — always valid | tbd | Per-provider HMAC/signature + server-side re-verify | 🔴 |
IBnplProvider |
backend-phase-12 | BNPL — drives state machine, fake settle/revert | tbd | SnappPay/Digipay OAuth + verb set; encrypted creds in payment_gateways.config_json |
🔴 |
ICurrencyNormalizer |
backend-phase-12 | Toman↔IRR — ×10 | tbd | Config-driven per provider boundary | 🔴 |
IBankTransferProvider |
backend-phase-13 | PAYA/SATNA payout — fake transfer ref | tbd | Jibit/Vandar/Sadad payout; source account; PAYA vs SATNA | 🔴 |
IHolidayCalendar |
backend-phase-1 | Bank holidays — reads the seeded ops.IranianHolidays table; lookups cached (HolidayCalendarService, Persistence/Services/Holidays/); Iranian banking weekend = Friday |
none | Add a sync job/feed that maintains the (partly lunar-Hijri) calendar table; the read interface stays | 🟡 |
IAnalyticsSink |
backend-phase-1 | Behavioural events — inserts an ops.SystemEvents row, fire-and-forget (AnalyticsSink, Persistence/Services/Analytics/) |
none | Pipe to a warehouse/stream (e.g. Kafka→ClickHouse); keep fire-and-forget semantics | 🟡 |
IJobScheduler (retention) |
backend-phase-1 | Scheduling — in-process interval BackgroundService running PurgeOldReadNotifications daily (NotificationRetentionHostedService, Persistence/Services/Notifications/) |
none | Swap to Hangfire/Quartz; register the job there; keep the purge predicate (is_read=1 AND age>90d) |
🟡 |
IShahkarVerifier |
backend-phase-6 | Phone↔national-id match — fake pass | tbd | Real Shahkar/KYC vendor; persist external_response_json |
🔴 |
IIdentityKycProvider |
backend-phase-6 | National-ID + liveness — fake pass | tbd | Finnotech/U-ID/Jibbit/Verify liveness+OCR | 🔴 |
ICredentialVerifier |
backend-phase-6 | MoH/INO/criminal-record — manual/fake | tbd | Manual admin today; API when a portal appears (verification_method=api) |
🔴 |
IBankAccountOwnershipVerifier |
backend-phase-3/6 | استعلام شبا IBAN↔national-id — fake match | tbd | Real KYC vendor; store ownership_vendor_ref |
🔴 |
IGeocoder |
backend-phase-4 | Address→lat/lng — echo/static | tbd | Neshan/Google geocoding | 🔴 |
IMoadianClient |
backend-phase-11 | سامانه مودیان e-invoice — leaves ref pending | tbd | Real مودیان submission → 22-digit ref | 🔴 |
IReviewModerationService |
backend-phase-14 | AI moderation — keyword/pass-through | tbd | Real classifier/LLM endpoint | 🔴 |
IFieldEncryptor |
backend-phase-0 | PII encryption — AES-256-CBC + HMAC hash from a local symmetric key (SymmetricFieldEncryptor, Baya.Infrastructure.CrossCutting/Seams/) |
Seams:FieldEncryption:Key, Seams:FieldEncryption:HashKey |
KMS / column encryption / Key Vault / HSM | 🟡 |
INotificationDispatcher |
backend-phase-0/1 | Notification channels — in-app write is now real (InAppNotificationDispatcher, Persistence/Services/Notifications/, writes an ops.Notifications row); b0 log stub removed. SMS/push channels still deferred (no-op) behind the same seam |
none | Add SMS (ISmsSender) / push (FCM) channels; polling → Redis pub/sub or SignalR later |
🟡 |
ILicenseVerificationService |
backend-phase-15 | eNamad / MoH establishment-permit — manual approve | tbd | Real registry/API | 🔴 |
Exact config keys and file paths get filled in by the phase that builds each seam. Keep the "Make it real →" column actionable enough that a developer can pick up any single row and ship it.