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
+32
View File
@@ -0,0 +1,32 @@
package utils
import (
"fmt"
"gestion/db"
"gestion/models"
"math/rand"
"os"
"path/filepath"
)
// --------------------------------------------
// MEDIA
// --------------------------------------------
func GetMediaForProduct(productID int) ([]models.Media, error) {
return db.DB.GetMediaByProductID(productID)
}
// --------------------------------------------
// FILES NAMES
// --------------------------------------------
func GenerateUniqueFileName(productName string, originalFileName string) string {
randomString := fmt.Sprintf("%d", rand.Intn(1000000))
ext := filepath.Ext(originalFileName)
return fmt.Sprintf("%s_%s%s", productName, randomString, ext)
}
func DeleteOldFile(filePath string) error {
return os.Remove(filePath)
}