chore: add ansible backend docker frontend-prep
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type Product struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name" binding:"required"`
|
||||
Category string `json:"category" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
Stock float64 `json:"stock"` // ← ajouter le stock ici
|
||||
Prices []ProductPrice `json:"prices"`
|
||||
Media []Media `json:"media,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type ProductPrice struct {
|
||||
ID int `json:"id"`
|
||||
ProductID int `json:"product_id"`
|
||||
Quantity int `json:"quantity" binding:"required"`
|
||||
Price float64 `json:"price" binding:"required"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type StockInfo struct {
|
||||
ProductID int `json:"product_id"`
|
||||
ProductName string `json:"product_name"`
|
||||
Category string `json:"category"`
|
||||
Quantity int `json:"quantity"`
|
||||
Reserved int `json:"reserved"`
|
||||
Available int `json:"available"`
|
||||
LastUpdated string `json:"last_updated"`
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// MÉTHODES POUR L'INTERFACE ProductInterface
|
||||
// ============================================
|
||||
func (p *Product) GetName() string { return p.Name }
|
||||
func (p *Product) GetCategory() string { return p.Category }
|
||||
func (p *Product) GetDescription() string { return p.Description }
|
||||
func (p *Product) GetStock() float64 { return p.Stock } // ← méthode pour le stock
|
||||
func (p *Product) GetPrices() []ProductPrice { return p.Prices }
|
||||
func (p *Product) SetID(id int) { p.ID = id }
|
||||
func (p *Product) SetCreatedAt(t time.Time) { p.CreatedAt = t }
|
||||
func (p *Product) SetUpdatedAt(t time.Time) { p.UpdatedAt = t }
|
||||
Reference in New Issue
Block a user