synchronisation du contenu avec la DB et amélioration du CMS

- Migration du blog et des interviews des données mockées vers PostgreSQL (Prisma).
- Refonte des pages publiques en Server Components pour de meilleures performances/SEO.
- Intégration d'un éditeur de texte riche (React Quill) avec titres H1-H6 et séparateurs.
- Correction des erreurs de validation Prisma liées aux paramètres asynchrones (Next.js 15+).
- Correction des problèmes d'affichage des modales de suspension via React Portals.
- Installation de @tailwindcss/typography et correction du débordement de texte (break-words).
- Implémentation des actions de modération (suspension/révocation) pour les utilisateurs et boutiques.
This commit is contained in:
2026-04-12 18:59:20 +02:00
parent b73939d381
commit 887030ee47
84 changed files with 5577 additions and 15128 deletions

View File

@@ -0,0 +1,35 @@
import { NextRequest, NextResponse } from 'next/server'
import prisma from '../../../../../lib/prisma'
// PATCH /api/conversations/[id]/archive — Toggle archive status for the user
export async function PATCH(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
try {
const userId = request.headers.get('x-user-id')
const { id } = await params
const { archived } = await request.json()
if (!userId) {
return NextResponse.json({ error: 'Utilisateur non identifié' }, { status: 401 })
}
const updatedParticipant = await prisma.conversationParticipant.update({
where: {
userId_conversationId: {
userId: userId,
conversationId: id
}
},
data: {
isArchived: archived ?? true
}
})
return NextResponse.json(updatedParticipant)
} catch (error) {
console.error('PATCH /api/conversations/[id]/archive error:', error)
return NextResponse.json({ error: 'Erreur serveur' }, { status: 500 })
}
}

View File

@@ -0,0 +1,60 @@
import { NextRequest, NextResponse } from 'next/server'
import prisma from '../../../../lib/prisma'
// GET /api/conversations/[id] — Get messages for a conversation
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
try {
const userId = request.headers.get('x-user-id')
const { id } = await params
if (!userId) {
return NextResponse.json({ error: 'Utilisateur non identifié' }, { status: 401 })
}
// Verify user is a participant
const isParticipant = await prisma.conversationParticipant.findUnique({
where: {
userId_conversationId: {
userId: userId,
conversationId: id
}
}
})
if (!isParticipant) {
return NextResponse.json({ error: 'Accès non autorisé' }, { status: 403 })
}
const messages = await prisma.message.findMany({
where: { conversationId: id },
orderBy: { createdAt: 'asc' },
include: {
sender: {
select: {
id: true,
name: true,
avatar: true
}
}
}
})
// Mark messages as read (where sender is not the current user)
await prisma.message.updateMany({
where: {
conversationId: id,
senderId: { not: userId },
read: false
},
data: { read: true }
})
return NextResponse.json(messages)
} catch (error) {
console.error('GET /api/conversations/[id] error:', error)
return NextResponse.json({ error: 'Erreur serveur' }, { status: 500 })
}
}