chore: build

This commit is contained in:
2026-06-13 19:18:12 +02:00
parent 59d4f89a14
commit 093a7e0c42
8 changed files with 110 additions and 35 deletions
+10 -3
View File
@@ -97,6 +97,8 @@ func (d *Database) InsertCommandItemWithClientInfo(
productID int,
quantite float64,
prix float64,
isReward bool,
rewardPoolKey string,
clientUsername, clientNom, clientPrenom, clientTelephone, deliveryAddress string,
) error {
log.Printf("📝 [InsertCommandItemWithClientInfo] START - commandID=%d, produit=%s", commandID, produit)
@@ -114,8 +116,11 @@ func (d *Database) InsertCommandItemWithClientInfo(
return err
}
if err := validatePrix(prix); err != nil {
return err
// Les articles récompense ont prix=0, on saute la validation de prix pour eux
if !isReward {
if err := validatePrix(prix); err != nil {
return err
}
}
if err := validateUsername(clientUsername); err != nil {
@@ -161,10 +166,12 @@ func (d *Database) InsertCommandItemWithClientInfo(
err := d.GDB.Exec(`
INSERT INTO command_items (
command_id, produit, product_id, quantite, prix,
is_reward, reward_pool_key,
client_username, client_nom, client_prenom, client_telephone, delivery_address,
status, created_at, updated_at
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'pending', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)`,
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'pending', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)`,
commandID, produit, productID, quantite, prix,
isReward, rewardPoolKey,
clientUsername, clientNom, clientPrenom, clientTelephone, deliveryAddress,
).Error
if err != nil {