chore: add ansible backend docker frontend-prep

This commit is contained in:
2026-01-21 13:05:13 +01:00
parent 5a280b6b01
commit 943fe4de7d
14930 changed files with 2341433 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
package models
type AlertPolicy struct {
ID int `json:"id"`
Username string `json:"username"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
+20
View File
@@ -0,0 +1,20 @@
// models/client.go
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"`
Point int `json:"point"`
PointZipette int `json:"points_zipette"`
Amende float64 `json:"amende"`
CancellationsCount int `json:"cancellations_count"` // ✅ NOUVEAU
LastPenaltyReason string `json:"last_penalty_reason"`
CreatedAt time.Time `json:"created_at"`
}
+39
View File
@@ -0,0 +1,39 @@
package models
import "time"
type Command struct {
ID int `json:"id"`
UserID int `json:"user_id"`
Username string `json:"username"`
Status string `json:"status"` // "pending", "assigned", "livre", "approved", "cancelled", "disabled"
Total float64 `json:"total"`
DeliveryAddress string `json:"delivery_address"` // Adresse de livraison pour cette commande
LivreurAssign string `json:"livreur_assign,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// CommandItem représente un produit dans une commande
type CommandItem struct {
ID int `json:"id"`
CommandID int `json:"command_id"`
ProductID int `json:"product_id"`
Quantity int `json:"quantity"`
Price float64 `json:"price"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type CommandPriority struct {
ID int `json:"id"`
Username string `json:"username"`
Status string `json:"status"`
Address string `json:"address"`
TotalPrice float64 `json:"total_price"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
WaitingSeconds int `json:"waiting_seconds"`
WaitingMinutes int `json:"waiting_minutes"`
PriorityScore float64 `json:"priority_score"`
}
+23
View File
@@ -0,0 +1,23 @@
package models
import "time"
type LivreurPosition struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
UpdatedAt time.Time `json:"updated_at"`
Status string `json:"status"` // "idle", "en_route", "arrived"
}
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"`
}
+17
View File
@@ -0,0 +1,17 @@
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é
}
// Méthodes pour l'interface Database
func (m *Media) GetProductID() int { return m.ProductID }
func (m *Media) GetType() string { return m.Type }
func (m *Media) GetURL() string { return m.URL }
func (m *Media) SetID(id int) { m.ID = id }
+16
View File
@@ -0,0 +1,16 @@
package models
import "time"
type Panier struct {
ID int `json:"id"`
Username string `json:"username"`
ProductID int `json:"product_id"`
ProductName string `json:"product_name"`
Category string `json:"category"`
Description string `json:"description"`
Quantity float64 `json:"quantity"`
Price float64 `json:"price"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
+45
View File
@@ -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 }
+29
View File
@@ -0,0 +1,29 @@
package models
import "time"
type CommandQueue struct {
CommandID int
Username string
TotalPrice float64
Address string
Lat float64 // ajouter
Lng float64 // ajouter
CreatedAt time.Time
EstimatedETA int
}
type DeliveryPersonStatus struct {
Username string `json:"username"`
Status string `json:"status"` // "available", "busy", "offline"
CurrentCommand int `json:"current_command,omitempty"`
LastUpdate time.Time `json:"last_update"`
}
type StockReservation struct {
ProductID int `json:"product_id"`
Quantity int `json:"quantity"`
Username string `json:"username"`
ExpiresAt time.Time `json:"expires_at"`
CommandID int `json:"command_id"`
}
+40
View File
@@ -0,0 +1,40 @@
package models
type Incident struct {
Type string `json:"type"`
Icon int `json:"iconCategory"`
Description string `json:"description"`
}
type IncidentResponse struct {
Incidents []struct {
Type string `json:"type"`
Icon int `json:"iconCategory"`
Description string `json:"description"`
} `json:"incidents"`
}
type RouteSummary struct {
TravelTimeInSeconds int `json:"travelTimeInSeconds"`
TravelTimeInMinutes int `json:"travelTimeInMinutes"` // Calculé
LengthInMeters int `json:"lengthInMeters"`
LengthInKm float64 `json:"lengthInKm"` // Calculé
TrafficDelayInSeconds int `json:"trafficDelayInSeconds,omitempty"`
DepartureTime string `json:"departureTime,omitempty"`
ArrivalTime string `json:"arrivalTime,omitempty"`
}
type RouteResponse struct {
Routes []struct {
Summary RouteSummary `json:"summary"`
Legs []struct {
Summary RouteSummary `json:"summary"`
} `json:"legs,omitempty"`
} `json:"routes"`
}
// IncidentsWithRoute combine incidents et informations de route
type IncidentsWithRoute struct {
Incidents []Incident `json:"incidents"`
Route RouteSummary `json:"route"`
}
+27
View File
@@ -0,0 +1,27 @@
package models
type UpdateClientProfileRequest struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"` // Optionnel
Nom string `json:"nom,omitempty"`
Prenom string `json:"prenom,omitempty"`
Telephone string `json:"telephone,omitempty"`
}
type UpdateUserProfileRequest struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"` // Optionnel
Role string `json:"role,omitempty"`
}
type AdminUpdateClientRequest struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"` // Optionnel
Nom string `json:"nom,omitempty"`
Prenom string `json:"prenom,omitempty"`
Telephone string `json:"telephone,omitempty"`
Command *int `json:"command,omitempty"`
Point *int `json:"point,omitempty"`
PointsZipette *int `json:"points_zipette,omitempty"`
Amende *float64 `json:"amende,omitempty"`
}
+8
View File
@@ -0,0 +1,8 @@
package models
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"
}