feat: normaliser les URL production par entité
Some checks failed
Validation applicative / TypeScript, tests et build (push) Failing after 1m35s
Some checks failed
Validation applicative / TypeScript, tests et build (push) Failing after 1m35s
This commit is contained in:
@@ -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'}`
|
||||
|
||||
Reference in New Issue
Block a user