1.3 KiB
1.3 KiB
Mana Collection Backend — Context
Product
Multi-seller fashion marketplace. Each seller is a Store with one STORE_ADMIN owner.
Future dashboards:
store.manacollections.ir— store admincustomer.manacollections.ir— customeradmin.manacollections.ir— super admin
Patterns (from Mado Motor)
- Nest 11, Prisma 6, bcrypt, passport-jwt
- Meshkee SMS (
MESHKEE_SMS_*) - Parspack S3 with project prefix
mana-collection/(Mado usesmado-motor/) - Opaque refresh tokens (hashed in DB), JWT access with
{ sub, role, storeId? } - OTP: SHA-256 hash, 6 digits, 5 min TTL, 60s resend, 5 attempts
Store lifecycle
- Public
storeRegisterOTP → createsUser(STORE_ADMIN)+Store(pending) - Super admin sets status
active(orrejectedwith reason) - Pending store: only
GET/PATCH /stores/me - Active store: full products/categories/brands/blogs/orders/customers CRUD
Multi-store orders
Order can span multiple stores via OrderItem.storeId and per-store OrderStoreFulfillment. Store admins see only their items + update their fulfillment status. Super admin manages overall Order.status.
Catalog variants
Categories hold colors[], sizes[], packages[] (catalog ids). Products have nested ProductVariant rows with colorId / sizeId / packageId + prices. Static catalogs exposed at /catalog.