Files

1.8 KiB

Mado Motor Admin API

NestJS + Prisma + PostgreSQL backend for the admin dashboard.

Features

  • Auth: phone (09…) + password, OTP one-time login, forgot-password OTP, register OTP
  • SMS: Meshkee partner gateway (same as Balout)
  • Images: Parspack S3 (same bucket as Balout/Meshkee), folder prefix mado-motor/
  • Admin CRUD: products, orders, customers, blogs, representations, reviews, call-requests, media upload

Quick start

cd backend
cp .env.example .env   # fill S3 + Meshkee SMS + JWT secrets
npm install
npm run db:up
npx prisma migrate dev
npm run create-super-admin -- --phone 09127004945 --password 'your-pass' --first علیرضا --last حسنی
npm run start:dev

API: http://localhost:3001/api/v1
Dashboard expects: VITE_API_URL=http://api.madomotor.com:3001 (add hosts entry → 127.0.0.1)

Storage layout

mado-motor/
  products/main/{uuid}.jpg
  products/gallery/{uuid}.jpg
  blogs/{uuid}.jpg
  users/{uuid}.jpg
  temp/{uuid}.jpg

Upload: POST /api/v1/media/upload?kind=main|gallery|blog|temp (multipart field file, admin JWT)

SMS (Meshkee)

Add partner on Meshkee production:

SMS_PARTNERS=…,madomotor.ir:<long-random-secret>

Then set in .env:

MESHKEE_SMS_URL=https://api.meshkee.com/api/v1/public/sms/send
MESHKEE_SMS_API_KEY=<that-secret>
MESHKEE_SMS_DOMAIN=madomotor.ir

Auth routes

Method Path Notes
POST /auth/login { cellNumber, password }
POST /auth/login/send-code OTP login
POST /auth/login/verify { cellNumber, code }
POST /auth/forgot-password/* send-code / verify / reset
POST /auth/register/* send-code / verify
POST /auth/refresh { refreshToken }
GET /auth/me Bearer

Test SMS

npm run send-sms -- --to 09127004945 --message "test"