Added new design to modals
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import { getCurrentUser } from '@/lib/auth';
|
||||
import { createNotificationForAllUsers } from '@/lib/notifications';
|
||||
|
||||
// GET - Liste tous les trajets avec leurs relations
|
||||
export async function GET(request: NextRequest) {
|
||||
@@ -125,6 +126,25 @@ export async function POST(request: NextRequest) {
|
||||
},
|
||||
});
|
||||
|
||||
// Créer une notification pour tous les utilisateurs sauf celui qui a créé le trajet
|
||||
const dateFormatted = new Date(date).toLocaleDateString('fr-FR', {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
|
||||
await createNotificationForAllUsers(
|
||||
{
|
||||
type: 'trajet_created',
|
||||
title: 'Nouveau trajet programmé',
|
||||
message: `Trajet programmé pour ${trajet.adherent.prenom} ${trajet.adherent.nom} le ${dateFormatted}`,
|
||||
link: '/dashboard/calendrier',
|
||||
},
|
||||
user.id
|
||||
);
|
||||
|
||||
return NextResponse.json(trajet, { status: 201 });
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la création du trajet:', error);
|
||||
|
||||
Reference in New Issue
Block a user