Notifications
Endpoints
| Endpoint | Usage |
|---|---|
GET /notifications | Liste des notifications de l'utilisateur connecté |
GET /notifications/{id} | Détail |
POST /notifications/{id}/mark-as-read | Marquer comme lue |
GET /notifications/status?is_read= | Filtrer par statut de lecture |
Objet notification (REST)
{
id: number;
title: string;
message: string;
payload: string; // JSON sérialisé en chaîne, non parsé automatiquement
is_read: number; // 0 = non lue, 1 = lue
created_at: string;
updated_at?: string;
user: {
id: number;
username: string;
avatar: string | null;
first_name: string;
last_name: string;
};
}
remarque
Il n'existe aucun champ type/catégorie ni link de redirection sur l'objet notification REST — seuls title, message et un payload libre existent. Le typage/catégorisation des notifications n'apparaît que côté temps réel (voir ci-dessous).
Envoi d'une notification (support)
{
title: string;
message: string;
payload: string;
role: string; // rôle ciblé, ex. "support" | "admin"
user_ids?: number[]; // ou utilisateurs ciblés explicitement
}
Temps réel
Deux transports coexistent, chacun avec son propre typage :
WebSocket :
{
type: "new_reservation" | "reservation_confirmed" | "reservation_cancelled" | "payment_received" | "refund_pending" | "message";
title: string;
message: string;
data?: { reservation_id?: number; property_name?: string; [key: string]: any };
timestamp: string;
}
Mercure (SSE) :
{
type: "notification.general" | "booking.created" | "booking.confirmed" | "booking.cancelled" | "payment.succeeded" | "message.received";
data: {
id: string;
title: string;
message: string;
timestamp: string;
metadata?: Record<string, any>;
};
}