chore: update id order
This commit is contained in:
@@ -3,9 +3,11 @@ package models
|
||||
import "time"
|
||||
|
||||
type Address struct {
|
||||
ID int64 `db:"id"`
|
||||
InvalidAddress string `db:"invalid_address"`
|
||||
CorrectAddress string `db:"correct_address"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
ID int64 `db:"id" gorm:"primaryKey;autoIncrement"`
|
||||
InvalidAddress string `db:"invalid_address" gorm:"column:invalid_address"`
|
||||
CorrectAddress string `db:"correct_address" gorm:"column:correct_address"`
|
||||
CreatedAt time.Time `db:"created_at" gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `db:"updated_at" gorm:"autoUpdateTime"`
|
||||
}
|
||||
|
||||
func (Address) TableName() string { return "adresse_correction" }
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type AlertPolicy struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Status string `json:"status"`
|
||||
Message string `json:"message"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ID int `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||
Username string `json:"username" gorm:"column:username"`
|
||||
Status string `json:"status" gorm:"column:status"`
|
||||
Message string `json:"message" gorm:"column:message"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||
}
|
||||
|
||||
func (AlertPolicy) TableName() string { return "alerte_policy" }
|
||||
|
||||
@@ -4,19 +4,20 @@ package models
|
||||
import "time"
|
||||
|
||||
type Client struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"-"` // Ne jamais exposer le password dans le JSON
|
||||
Nom string `json:"nom"`
|
||||
Prenom string `json:"prenom"`
|
||||
Telephone string `json:"telephone"`
|
||||
Command int `json:"command"`
|
||||
PointsExtra map[string]int `json:"points_extra"`
|
||||
Amende float64 `json:"amende"`
|
||||
CancellationsCount int `json:"cancellations_count"`
|
||||
LastPenaltyReason string `json:"last_penalty_reason"`
|
||||
MustChangePassword bool `json:"must_change_password"`
|
||||
PushToken string `json:"-"`
|
||||
ReferralBalance float64 `json:"referral_balance"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||
Username string `gorm:"column:username" json:"username"`
|
||||
Password string `gorm:"column:password" json:"-"`
|
||||
Nom string `gorm:"column:nom" json:"nom"`
|
||||
Prenom string `gorm:"column:prenom" json:"prenom"`
|
||||
Telephone string `gorm:"column:telephone" json:"telephone"`
|
||||
Command int `gorm:"column:command" json:"command"`
|
||||
PointsExtra map[string]int `gorm:"-" json:"points_extra"`
|
||||
Amende float64 `gorm:"column:amende" json:"amende"`
|
||||
CancellationsCount int `gorm:"column:cancellations_count" json:"cancellations_count"`
|
||||
LastPenaltyReason string `gorm:"column:last_penalty_reason" json:"last_penalty_reason"`
|
||||
MustChangePassword bool `gorm:"column:must_change_password" json:"must_change_password"`
|
||||
ReferralBalance float64 `gorm:"column:referral_balance" json:"referral_balance"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
||||
}
|
||||
|
||||
func (Client) TableName() string { return "clients" }
|
||||
|
||||
@@ -10,14 +10,16 @@ type LivreurPosition struct {
|
||||
}
|
||||
|
||||
type DeliveryIssue struct {
|
||||
ID int `json:"id"`
|
||||
CommandID int `json:"command_id"`
|
||||
IssueType string `json:"issue_type"`
|
||||
Description string `json:"description"`
|
||||
Status string `json:"status"` // "open", "in_progress", "resolved"
|
||||
ReportedBy string `json:"reported_by"`
|
||||
ResolvedBy string `json:"resolved_by,omitempty"`
|
||||
Resolution string `json:"resolution,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID int `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||
CommandID int `json:"command_id" gorm:"column:command_id;index"`
|
||||
IssueType string `json:"issue_type" gorm:"column:issue_type"`
|
||||
Description string `json:"description" gorm:"column:description"`
|
||||
Status string `json:"status" gorm:"column:status"`
|
||||
ReportedBy string `json:"reported_by" gorm:"column:reported_by"`
|
||||
ResolvedBy string `json:"resolved_by,omitempty" gorm:"column:resolved_by"`
|
||||
Resolution string `json:"resolution,omitempty" gorm:"column:resolution"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||
}
|
||||
|
||||
func (DeliveryIssue) TableName() string { return "delivery_issues" }
|
||||
|
||||
@@ -3,13 +3,15 @@ package models
|
||||
import "time"
|
||||
|
||||
type Media struct {
|
||||
ID int `json:"id"`
|
||||
ProductID int `json:"product_id"`
|
||||
Type string `json:"type"`
|
||||
URL string `json:"url"`
|
||||
CreatedAt time.Time `json:"created_at"` // ✅ Ajouté
|
||||
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||
ProductID int `gorm:"column:product_id" json:"product_id"`
|
||||
Type string `gorm:"column:type" json:"type"`
|
||||
URL string `gorm:"column:url" json:"url"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
||||
}
|
||||
|
||||
func (Media) TableName() string { return "media" }
|
||||
|
||||
// Méthodes pour l'interface Database
|
||||
func (m *Media) GetProductID() int { return m.ProductID }
|
||||
func (m *Media) GetType() string { return m.Type }
|
||||
|
||||
@@ -4,15 +4,17 @@ import "time"
|
||||
|
||||
// CryptoPayment suit un paiement crypto NowPayments lié à une commande
|
||||
type CryptoPayment struct {
|
||||
ID int `json:"id"`
|
||||
CommandID int `json:"command_id"`
|
||||
NowPaymentID string `json:"nowpayment_id"`
|
||||
Status string `json:"status"` // waiting, confirming, confirmed, sending, partially_paid, finished, failed, refunded, expired
|
||||
PriceAmount float64 `json:"price_amount"`
|
||||
PriceCurrency string `json:"price_currency"`
|
||||
PayCurrency string `json:"pay_currency"`
|
||||
PayAddress string `json:"pay_address"`
|
||||
PayAmount float64 `json:"pay_amount"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID int `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||
CommandID int `json:"command_id" gorm:"column:command_id;index"`
|
||||
NowPaymentID string `json:"nowpayment_id" gorm:"column:nowpayment_id;uniqueIndex"`
|
||||
Status string `json:"status" gorm:"column:status"`
|
||||
PriceAmount float64 `json:"price_amount" gorm:"column:price_amount"`
|
||||
PriceCurrency string `json:"price_currency" gorm:"column:price_currency"`
|
||||
PayCurrency string `json:"pay_currency" gorm:"column:pay_currency"`
|
||||
PayAddress string `json:"pay_address" gorm:"column:pay_address"`
|
||||
PayAmount float64 `json:"pay_amount" gorm:"column:pay_amount"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||
}
|
||||
|
||||
func (CryptoPayment) TableName() string { return "crypto_payments" }
|
||||
|
||||
@@ -3,26 +3,30 @@ 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
|
||||
Unit string `json:"unit"` // kg | g | bag | l | cl | pcs | u
|
||||
Prices []ProductPrice `json:"prices"`
|
||||
Media []Media `json:"media,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID int `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||
Name string `json:"name" gorm:"column:name" binding:"required"`
|
||||
Category string `json:"category" gorm:"column:category" binding:"required"`
|
||||
Description string `json:"description" gorm:"column:description"`
|
||||
Stock float64 `json:"stock" gorm:"column:stock"`
|
||||
Unit string `json:"unit" gorm:"column:unit"`
|
||||
Prices []ProductPrice `json:"prices" gorm:"foreignKey:ProductID"`
|
||||
Media []Media `json:"media,omitempty" gorm:"foreignKey:ProductID"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||
}
|
||||
|
||||
func (Product) TableName() string { return "products" }
|
||||
|
||||
type ProductPrice struct {
|
||||
ID int `json:"id"`
|
||||
ProductID int `json:"product_id"`
|
||||
Quantity float64 `json:"quantity" binding:"required"`
|
||||
Price float64 `json:"price" binding:"required"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
ID int `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||
ProductID int `json:"product_id" gorm:"column:product_id;index"`
|
||||
Quantity float64 `json:"quantity" gorm:"column:quantity" binding:"required"`
|
||||
Price float64 `json:"price" gorm:"column:price" binding:"required"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||
}
|
||||
|
||||
func (ProductPrice) TableName() string { return "product_prices" }
|
||||
|
||||
type StockInfo struct {
|
||||
ProductID int `json:"product_id"`
|
||||
ProductName string `json:"product_name"`
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type User struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password,omitempty"` // omitempty pour ne pas l'exposer dans les réponses JSON
|
||||
Role string `json:"role"` // "user" ou "admin"
|
||||
ID int `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||
Username string `json:"username" gorm:"column:username;uniqueIndex"`
|
||||
Password string `json:"password,omitempty" gorm:"column:password"`
|
||||
Role string `json:"role" gorm:"column:role"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||
}
|
||||
|
||||
func (User) TableName() string { return "users" }
|
||||
|
||||
Reference in New Issue
Block a user