Product Model
The Product model represents a base product that contains product variants. Products are containers that group variants together.
Structure
{
"id": 1,
"store_id": 5,
"store": {
"id": 5,
"name": "My Store",
"email": "store@example.com",
...
},
"category_id": 3,
"category": {
"id": 3,
"name": "Electronics",
"image": "https://...",
"parent_id": null
},
"brand_id": 2,
"brand": {
"id": 2,
"name": "Brand Name",
"image": "https://..."
},
"currency_id": 1,
"currency": {
"id": 1,
"name": "AZN",
"value": 1.0
},
"created": "2025-01-15T10:30:00Z"
}
Fields
| Field | Type | Description | Notes |
|---|---|---|---|
id |
integer | Unique identifier | Auto-increment, primary key |
store_id |
integer | Store that owns this product | Required, foreign key to StoreModel |
category_id |
integer | Product category | Required, foreign key to CategoryModel |
brand_id |
integer | Product brand | Optional, nullable, foreign key to BrandModel |
currency_id |
integer | Currency for pricing | Required, foreign key to CurrencyModel |
is_deleted |
boolean | Soft delete flag | Default: false |
created |
datetime | Creation timestamp | Auto-generated |
updated |
datetime | Last update timestamp | Auto-updated |
Relationships
- StoreModel: Many-to-one relationship with store
- CategoryModel: Many-to-one relationship with category
- BrandModel: Many-to-one relationship with brand (optional)
- CurrencyModel: Many-to-one relationship with currency
- ProductVariantModel: One-to-many relationship with product variants
Notes
- Products are base containers; actual sellable items are Product Variants
- Products without variants are considered "base products" (no variants created yet)
- Products are automatically associated with the authenticated store when created
- Soft deleted products cannot be retrieved or used
- Brand is optional; products can exist without a brand