feat: normaliser les URL production par entité
Some checks failed
Validation applicative / TypeScript, tests et build (push) Failing after 1m35s

This commit is contained in:
Santinova Deployment
2026-10-24 17:06:48 +00:00
parent a7845f5b06
commit 9e097e585a
12 changed files with 37 additions and 36 deletions

View File

@@ -11,17 +11,17 @@ export async function getParametres() {
if (!db) throw new Error("Database not available");
const result = await db.select().from(parametres).limit(1);
if (result.length === 0) {
// Créer les paramètres par défaut
await db.insert(parametres).values({
urlPublique: "https://formations.itinova.org",
urlPublique: "https://formations-itinova.santinova-soft.org",
});
const newResult = await db.select().from(parametres).limit(1);
return newResult[0];
}
return result[0];
}
@@ -44,7 +44,7 @@ export async function updateParametres(
if (!db) throw new Error("Database not available");
const params = await getParametres();
// Enregistrer l'historique pour chaque champ modifié
for (const [key, value] of Object.entries(updates)) {
const oldValue = params[key as keyof typeof params];
@@ -58,12 +58,12 @@ export async function updateParametres(
});
}
}
// Mettre à jour les paramètres
await db.update(parametres)
.set(updates)
.where(eq(parametres.id, params.id));
return getParametres();
}
@@ -113,8 +113,8 @@ export async function testerUrl(url: string): Promise<{ accessible: boolean; mes
return {
accessible: response.ok,
message: response.ok
? "L'URL est accessible"
message: response.ok
? "L'URL est accessible"
: `L'URL a retourné une erreur HTTP ${response.status}`,
statusCode: response.status
};
@@ -125,7 +125,7 @@ export async function testerUrl(url: string): Promise<{ accessible: boolean; mes
message: "Format d'URL invalide"
};
}
return {
accessible: false,
message: `Erreur lors du test: ${error instanceof Error ? error.message : 'Erreur inconnue'}`