Checkpoint: Amélioration de la gestion d'erreur sur la page des notifications - affichage des messages d'erreur au lieu de planter
This commit is contained in:
13
.manus/db/db-query-1765832673712.json
Normal file
13
.manus/db/db-query-1765832673712.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"query": "SHOW TABLES LIKE 'logsNotifications';",
|
||||
"command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.root --database 7PAT67UmWoxv8vwp8Bbcv6 --execute SHOW TABLES LIKE 'logsNotifications';",
|
||||
"rows": [
|
||||
{
|
||||
"Tables_in_7PAT67UmWoxv8vwp8Bbcv6 (logsNotifications)": "logsNotifications"
|
||||
}
|
||||
],
|
||||
"messages": [],
|
||||
"stdout": "Tables_in_7PAT67UmWoxv8vwp8Bbcv6 (logsNotifications)\nlogsNotifications\n",
|
||||
"stderr": "",
|
||||
"execution_time_ms": 76
|
||||
}
|
||||
106
.manus/db/db-query-1765832676914.json
Normal file
106
.manus/db/db-query-1765832676914.json
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"query": "DESCRIBE logsNotifications;",
|
||||
"command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.root --database 7PAT67UmWoxv8vwp8Bbcv6 --execute DESCRIBE logsNotifications;",
|
||||
"rows": [
|
||||
{
|
||||
"Field": "id",
|
||||
"Type": "int(11)",
|
||||
"Null": "NO",
|
||||
"Key": "PRI",
|
||||
"Default": "NULL",
|
||||
"Extra": "auto_increment"
|
||||
},
|
||||
{
|
||||
"Field": "type",
|
||||
"Type": "enum('remerciement','notification_formateur_inscription','notification_formateur_annulation','alerte_capacite','notification_liste_attente')",
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "NULL",
|
||||
"Extra": ""
|
||||
},
|
||||
{
|
||||
"Field": "sequenceId",
|
||||
"Type": "int(11)",
|
||||
"Null": "YES",
|
||||
"Key": "",
|
||||
"Default": "NULL",
|
||||
"Extra": ""
|
||||
},
|
||||
{
|
||||
"Field": "apprenantId",
|
||||
"Type": "int(11)",
|
||||
"Null": "YES",
|
||||
"Key": "",
|
||||
"Default": "NULL",
|
||||
"Extra": ""
|
||||
},
|
||||
{
|
||||
"Field": "formateurId",
|
||||
"Type": "int(11)",
|
||||
"Null": "YES",
|
||||
"Key": "",
|
||||
"Default": "NULL",
|
||||
"Extra": ""
|
||||
},
|
||||
{
|
||||
"Field": "emailDestinataire",
|
||||
"Type": "varchar(320)",
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "NULL",
|
||||
"Extra": ""
|
||||
},
|
||||
{
|
||||
"Field": "sujet",
|
||||
"Type": "varchar(500)",
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "NULL",
|
||||
"Extra": ""
|
||||
},
|
||||
{
|
||||
"Field": "dateEnvoi",
|
||||
"Type": "timestamp",
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "CURRENT_TIMESTAMP",
|
||||
"Extra": ""
|
||||
},
|
||||
{
|
||||
"Field": "statut",
|
||||
"Type": "enum('success','failed')",
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "NULL",
|
||||
"Extra": ""
|
||||
},
|
||||
{
|
||||
"Field": "messageErreur",
|
||||
"Type": "text",
|
||||
"Null": "YES",
|
||||
"Key": "",
|
||||
"Default": "NULL",
|
||||
"Extra": ""
|
||||
},
|
||||
{
|
||||
"Field": "metadata",
|
||||
"Type": "text",
|
||||
"Null": "YES",
|
||||
"Key": "",
|
||||
"Default": "NULL",
|
||||
"Extra": ""
|
||||
},
|
||||
{
|
||||
"Field": "createdAt",
|
||||
"Type": "timestamp",
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "CURRENT_TIMESTAMP",
|
||||
"Extra": ""
|
||||
}
|
||||
],
|
||||
"messages": [],
|
||||
"stdout": "Field\tType\tNull\tKey\tDefault\tExtra\nid\tint(11)\tNO\tPRI\tNULL\tauto_increment\ntype\tenum('remerciement','notification_formateur_inscription','notification_formateur_annulation','alerte_capacite','notification_liste_attente')\tNO\t\tNULL\t\nsequenceId\tint(11)\tYES\t\tNULL\t\napprenantId\tint(11)\tYES\t\tNULL\t\nformateurId\tint(11)\tYES\t\tNULL\t\nemailDestinataire\tvarchar(320)\tNO\t\tNULL\t\nsujet\tvarchar(500)\tNO\t\tNULL\t\ndateEnvoi\ttimestamp\tNO\t\tCURRENT_TIMESTAMP\t\nstatut\tenum('success','failed')\tNO\t\tNULL\t\nmessageErreur\ttext\tYES\t\tNULL\t\nmetadata\ttext\tYES\t\tNULL\t\ncreatedAt\ttimestamp\tNO\t\tCURRENT_TIMESTAMP\t\n",
|
||||
"stderr": "",
|
||||
"execution_time_ms": 51
|
||||
}
|
||||
@@ -63,7 +63,7 @@ export default function AdminNotifications() {
|
||||
const [page, setPage] = useState(0);
|
||||
const limit = 20;
|
||||
|
||||
const { data: historiqueData, isLoading: isLoadingHistorique, refetch } = trpc.notifications.historique.useQuery({
|
||||
const { data: historiqueData, isLoading: isLoadingHistorique, refetch, error: historiqueError } = trpc.notifications.historique.useQuery({
|
||||
type: filters.type as any || undefined,
|
||||
statut: filters.statut as any || undefined,
|
||||
email: filters.email || undefined,
|
||||
@@ -73,7 +73,7 @@ export default function AdminNotifications() {
|
||||
offset: page * limit,
|
||||
});
|
||||
|
||||
const { data: statsData, isLoading: isLoadingStats } = trpc.notifications.statistiques.useQuery({
|
||||
const { data: statsData, isLoading: isLoadingStats, error: statsError } = trpc.notifications.statistiques.useQuery({
|
||||
dateDebut: filters.dateDebut || undefined,
|
||||
dateFin: filters.dateFin || undefined,
|
||||
});
|
||||
@@ -129,6 +129,12 @@ export default function AdminNotifications() {
|
||||
<TabsContent value="statistiques" className="space-y-6">
|
||||
{isLoadingStats ? (
|
||||
<div className="text-center py-8 text-muted-foreground">Chargement...</div>
|
||||
) : statsError ? (
|
||||
<div className="text-center py-8 text-red-500">
|
||||
<AlertCircle className="h-8 w-8 mx-auto mb-2" />
|
||||
<p>Erreur lors du chargement des statistiques</p>
|
||||
<p className="text-sm text-muted-foreground mt-1">{statsError.message}</p>
|
||||
</div>
|
||||
) : statsData ? (
|
||||
<>
|
||||
{/* Cartes de statistiques globales */}
|
||||
@@ -378,6 +384,12 @@ export default function AdminNotifications() {
|
||||
<CardContent>
|
||||
{isLoadingHistorique ? (
|
||||
<div className="text-center py-8 text-muted-foreground">Chargement...</div>
|
||||
) : historiqueError ? (
|
||||
<div className="text-center py-8 text-red-500">
|
||||
<AlertCircle className="h-8 w-8 mx-auto mb-2" />
|
||||
<p>Erreur lors du chargement de l'historique</p>
|
||||
<p className="text-sm text-muted-foreground mt-1">{historiqueError.message}</p>
|
||||
</div>
|
||||
) : historiqueData?.logs.length === 0 ? (
|
||||
<div className="text-center py-8 text-muted-foreground">
|
||||
Aucune notification trouvée
|
||||
|
||||
Reference in New Issue
Block a user