fix backend audit findings (auth, upload, sync, data, ocr, contract)
CI / lint-backend (push) Failing after 1m39s
CI / lint-mobile (push) Canceled after 11m8s
CI / test-backend (push) Canceled after 0s
CI / test-mobile (push) Canceled after 0s
CI / build-backend (push) Canceled after 0s
CI / docker (push) Canceled after 0s

This commit is contained in:
m
2026-09-21 19:59:52 +02:00
parent df7dc76405
commit a6b7f2002b
60 changed files with 3414 additions and 412 deletions
+3 -1
View File
@@ -21,7 +21,9 @@ func NormalizeUsername(username string) string {
}
// EnsureAdmin crée le compte admin au premier démarrage si la table users est
// vide. Idempotent : l'env n'écrase jamais un compte existant.
// vide. Idempotent : l'env n'écrase jamais un compte existant. Seuls les
// comptes ACTIFS comptent (Users.Count filtre deleted_at, #9+A10) : une base
// 100% soft-deleted est vue comme vide et reçoit un nouvel admin.
func EnsureAdmin(repo *repository.Repository, username, password string) error {
count, err := repo.Users.Count()
if err != nil {