multivendor-prescription 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # multivendor-prescription
2
+
3
+ Wallet-style prescription plugin for multi-vendor marketplaces:
4
+
5
+ - Customer upload → admin approve/reject → cart lines
6
+ - TypeORM entities + migration (`1801000000000-CreatePrescriptionRequestTables`)
7
+ - HTTP controllers (routing-controllers)
8
+ - Host **ports** for cart / product / file / customer / email
9
+
10
+ ## Port error contract
11
+
12
+ | Port | Failure |
13
+ |------|---------|
14
+ | Cart write (approve) | Fatal → roll back txn |
15
+ | Product resolve (approve) | Fatal → roll back txn |
16
+ | File upload/read | Fatal for create/file |
17
+ | Customer lookup | Fatal |
18
+ | Email | **Non-fatal** — never undo approval |
19
+
20
+ Reject is usually single-table; if it writes more than `prescription_request`, use the same `EntityManager` rule as approve.
21
+
22
+ ## Two-phase host rollout
23
+
24
+ 1. **Phase 1:** Package + `PRESCRIPTION_PLUGIN` dual HTTP path; **one** entity class (package only).
25
+ 2. **Phase 2:** Delete legacy host controllers/service after staging verify.
26
+
27
+ ## Host wiring
28
+
29
+ ```ts
30
+ import {
31
+ registerPrescriptionPlugin,
32
+ getPrescriptionOrmMetadata,
33
+ PRESCRIPTION_PLUGIN_TOKEN,
34
+ } from 'multivendor-prescription';
35
+
36
+ // connectionOptions: merge getPrescriptionOrmMetadata().entities/migrations
37
+ // prescriptionLoader: registerPrescriptionPlugin({ dataSource, flags, ports, logger })
38
+ // Container.set(PRESCRIPTION_PLUGIN_TOKEN, plugin)
39
+ ```
40
+
41
+ ## Follow-ups
42
+
43
+ - Metrics counters (approve latency, email skip rate) — tracked in host issue [#4](https://github.com/SmartByteLabs-multivendor/Myownbazaar_server/issues/4).
44
+ - **Phase 2 cutover:** after staging with `PRESCRIPTION_PLUGIN=true`, delete legacy host controllers/service/repos/DTO wrappers and remove the dual-path flag.