feat: add admin dashboard and core API routes with Docker configuration

This commit is contained in:
2026-10-29 19:46:37 +01:00
parent 2fdabe1dfd
commit 4f4856d9dc
89 changed files with 1984 additions and 1034 deletions

View File

@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from 'next/server'
import prisma from '../../../../../lib/prisma'
import { getAuthUser } from '@/lib/auth-utils'
// PATCH /api/conversations/[id]/archive — Toggle archive status for the user
export async function PATCH(
@@ -7,18 +8,18 @@ export async function PATCH(
context: { params: Promise<{ id: string }> }
): Promise<Response> {
try {
const userId = request.headers.get('x-user-id')
const authUser = await getAuthUser(request)
const { id } = await context.params
const { archived } = await request.json()
if (!userId) {
if (!authUser) {
return NextResponse.json({ error: 'Utilisateur non identifié' }, { status: 401 })
}
const updatedParticipant = await prisma.conversationParticipant.update({
where: {
userId_conversationId: {
userId: userId,
userId: authUser.id,
conversationId: id
}
},

View File

@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from 'next/server'
import prisma from '../../../../lib/prisma'
import { getAuthUser } from '@/lib/auth-utils'
// GET /api/conversations/[id] — Get messages for a conversation
export async function GET(
@@ -7,13 +8,15 @@ export async function GET(
context: { params: Promise<{ id: string }> }
): Promise<Response> {
try {
const userId = request.headers.get('x-user-id')
const authUser = await getAuthUser(request)
const { id } = await context.params
if (!userId) {
if (!authUser) {
return NextResponse.json({ error: 'Utilisateur non identifié' }, { status: 401 })
}
const userId = authUser.id
// Verify user is a participant
const isParticipant = await prisma.conversationParticipant.findUnique({
where: {

View File

@@ -1,15 +1,17 @@
import { NextRequest, NextResponse } from 'next/server'
import prisma from '@/lib/prisma'
import { getAuthUser } from '@/lib/auth-utils'
// GET /api/conversations — List all conversations for the user
export async function GET(request: NextRequest) {
try {
const userId = request.headers.get('x-user-id')
const authUser = await getAuthUser(request)
if (!userId) {
if (!authUser) {
return NextResponse.json({ error: 'Utilisateur non identifié' }, { status: 401 })
}
const userId = authUser.id
const { searchParams } = new URL(request.url)
const businessId = searchParams.get('businessId')