🛍️ Shop API

GET /api/shop/products

دریافت لیست محصولات

Query Parameters:

پارامتر نوع توضیحات
category string اختیاری فیلتر بر اساس دسته‌بندی
is_active boolean اختیاری فیلتر محصولات فعال (پیش‌فرض: true)

Response (200 OK):

{
  "success": true,
  "products": [
    {
      "ProductID": "uuid",
      "Name": "نام محصول",
      "Description": "توضیحات",
      "Price": 100.50,
      "Stock": 10,
      "ImageURL": "https://...",
      "Category": "دسته‌بندی",
      "IsActive": true
    }
  ],
  "count": 1
}

POST /api/shop/products

ایجاد محصول جدید

Request Body:

فیلد نوع توضیحات
Name string الزامی نام محصول
Description string اختیاری توضیحات محصول
Price number الزامی قیمت محصول
Stock integer اختیاری موجودی (پیش‌فرض: 0)
ImageURL string اختیاری آدرس تصویر
Category string اختیاری دسته‌بندی
IsActive boolean اختیاری وضعیت فعال (پیش‌فرض: true)

Request Example:

{
  "Name": "محصول نمونه",
  "Description": "توضیحات محصول",
  "Price": 100.50,
  "Stock": 10,
  "ImageURL": "https://example.com/image.jpg",
  "Category": "الکترونیک",
  "IsActive": true
}

Response (201 Created):

{
  "success": true,
  "product": {
    "ProductID": "uuid",
    "Name": "محصول نمونه",
    "Price": 100.50,
    "Stock": 10
  }
}

GET /api/shop/products/{product_id}

دریافت جزئیات یک محصول

Path Parameters:

پارامتر نوع توضیحات
product_id string (UUID) الزامی شناسه محصول

Response (200 OK):

{
  "success": true,
  "product": {
    "ProductID": "uuid",
    "Name": "نام محصول",
    "Description": "توضیحات",
    "Price": 100.50,
    "Stock": 10,
    "ImageURL": "https://...",
    "Category": "دسته‌بندی",
    "IsActive": true
  }
}

Response (404 Not Found):

{
  "success": false,
  "error": "Product not found"
}