mirror of
https://git.meshkee.com/BaloutPastry/backend.git
synced 2026-08-11 22:31:00 +04:30
d09eca8702ba1451f4a150ac12d91f1f7deed84c
Co-authored-by: Cursor <cursoragent@cursor.com>
Balout Pastry API
NestJS + Prisma + PostgreSQL + JWT admin API for شیرینیفروشی بلوط.
Lives in Balout Pastry/Backend next to Dashboards/. Not wired to the UI yet.
Stack
- NestJS 11 / TypeScript
- Prisma 6 + PostgreSQL 16 (Docker Compose)
- JWT access + refresh tokens
- Parspack S3 (same credentials as Meshkee, prefix
balout/)
Quick start
From this folder (Backend/):
cp .env.example .env
npm install
npm run db:up
npx prisma migrate deploy
npm run create-super-admin -- --phone 09120000000 --password secret123
npm run start:dev # http://localhost:3100/api/v1
Auth rules
- Only
adminandsuperAdmincan log in - Only
superAdmincan assignadminorsuperAdminroles - Customers exist for a future customer dashboard
Main routes (/api/v1)
| Area | Methods |
|---|---|
| Auth | POST /auth/login, /auth/refresh, /auth/logout, GET /auth/me |
| Users | CRUD + PATCH /users/:id/role, /password + addresses under /users/:id/addresses |
| Flavors | CRUD |
| Categories | tree CRUD + `GET |
| Products | CRUD (options must match category templates); list filters q, categoryId, minPrice, maxPrice |
| Orders | GET /orders, GET /orders/:id, POST /orders, PATCH /orders/:id/status |
| Media | POST /media/upload?kind=main|gallery|temp |
| Settings | districts, shipping exceptions, branches |
Orders
Create body:
{
"customerId": "...",
"deliveryType": "pickup",
"branchId": "...",
"note": "optional",
"items": [
{ "productId": "...", "quantity": 2, "optionIds": ["..."] }
]
}
For shipping, use deliveryType: "shipping" and shippingAddressId (from user addresses). Prices and names are snapshotted at create time. Display code is BL-{number}.
Notes
- Prices are integer تومان
- Port 3100; Postgres 5434 (Meshkee uses 3000 / 5432)
Languages
TypeScript
99.3%
JavaScript
0.7%