62 lines
1.9 KiB
Markdown
62 lines
1.9 KiB
Markdown
# Mana Collection API
|
|
|
|
NestJS 11 + Prisma 6 + PostgreSQL multi-seller marketplace backend for **Mana Collection**.
|
|
|
|
- Public site: https://manacollections.ir
|
|
- API prefix: `/api/v1`
|
|
- Default port: `3002`
|
|
- Postgres Docker port: `5436`
|
|
- S3 prefix: `mana-collection/`
|
|
- SMS domain: `manacollections.ir`
|
|
|
|
## Quick start
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
# fill JWT secrets, S3 keys, MESHKEE_SMS_API_KEY
|
|
|
|
npm install
|
|
npm run db:up
|
|
npx prisma migrate deploy
|
|
npx prisma generate
|
|
|
|
npm run seed:mana-store -- --phone 09120000000 --password mana1234
|
|
# optional super admin:
|
|
# npm run seed:mana-store -- --phone 09120000000 --password mana1234 --super-phone 09127004945 --super-password admin1234
|
|
|
|
npm run start:dev
|
|
```
|
|
|
|
API: http://localhost:3002/api/v1
|
|
|
|
## Scripts
|
|
|
|
| Script | Purpose |
|
|
|--------|---------|
|
|
| `npm run db:up` | Start Postgres (port 5436) |
|
|
| `npm run prisma:migrate` | Dev migrations |
|
|
| `npm run prisma:deploy` | Apply migrations |
|
|
| `npm run create-super-admin` | Create `SUPER_ADMIN` |
|
|
| `npm run seed:mana-store` | Seed Mana Collection store + `STORE_ADMIN` |
|
|
| `npm run send-sms` | Send Meshkee SMS |
|
|
|
|
## Roles
|
|
|
|
- `CUSTOMER` — public registration
|
|
- `STORE_ADMIN` — owns one store; full catalog CRUD only when store is `active`
|
|
- `SUPER_ADMIN` — approve stores, all orders, all customers
|
|
|
|
## Key routes
|
|
|
|
- Auth: `POST /auth/login`, `/auth/register/*`, `/auth/refresh`, `GET /auth/me`
|
|
- Store register: `POST /public/stores/register/send-code`, `/verify`
|
|
- Store me: `GET|PATCH /stores/me`
|
|
- Admin stores: `GET /admin/stores`, `PATCH /admin/stores/:id/status`
|
|
- Products / categories / brands / blogs / customers / orders (JWT + role)
|
|
- Public: `GET /public/products`, `/public/products/:id`, `/public/stores`, `/public/blogs`
|
|
- Profile: `GET|PATCH /profile`, addresses CRUD
|
|
- Catalog: `GET /catalog` (colors / sizes / packages)
|
|
- Media: `POST /media/upload?kind=main|gallery|blog|brand|store|avatar|temp`
|
|
|
|
See `CONTEXT.md` for domain notes.
|