This commit is contained in:
@@ -4,11 +4,11 @@ import prisma from '../../../../../lib/prisma'
|
||||
// PATCH /api/admin/reports/[id] — Update report status
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const userId = request.headers.get('x-user-id')
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const { status } = await request.json()
|
||||
|
||||
if (!userId) {
|
||||
|
||||
@@ -4,9 +4,12 @@ import prisma from '../../../../lib/prisma'
|
||||
type Params = { params: Promise<{ id: string }> }
|
||||
|
||||
// GET /api/blog/[id]
|
||||
export async function GET(_request: NextRequest, { params }: Params) {
|
||||
export async function GET(
|
||||
_request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const post = await prisma.blogPost.findUnique({ where: { id } })
|
||||
if (!post) return NextResponse.json({ error: 'Non trouvé' }, { status: 404 })
|
||||
return NextResponse.json(post)
|
||||
@@ -17,9 +20,12 @@ export async function GET(_request: NextRequest, { params }: Params) {
|
||||
}
|
||||
|
||||
// PATCH /api/blog/[id]
|
||||
export async function PATCH(request: NextRequest, { params }: Params) {
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const body = await request.json()
|
||||
const post = await prisma.blogPost.update({ where: { id }, data: body })
|
||||
return NextResponse.json(post)
|
||||
@@ -30,9 +36,12 @@ export async function PATCH(request: NextRequest, { params }: Params) {
|
||||
}
|
||||
|
||||
// DELETE /api/blog/[id]
|
||||
export async function DELETE(_request: NextRequest, { params }: Params) {
|
||||
export async function DELETE(
|
||||
_request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
await prisma.blogPost.delete({ where: { id } })
|
||||
return NextResponse.json({ success: true })
|
||||
} catch (error) {
|
||||
|
||||
@@ -4,9 +4,12 @@ import prisma from '../../../../lib/prisma'
|
||||
type Params = { params: Promise<{ id: string }> }
|
||||
|
||||
// GET /api/businesses/[id]
|
||||
export async function GET(_request: NextRequest, { params }: Params) {
|
||||
export async function GET(
|
||||
_request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const business = await prisma.business.findFirst({
|
||||
where: {
|
||||
OR: [
|
||||
@@ -25,9 +28,12 @@ export async function GET(_request: NextRequest, { params }: Params) {
|
||||
}
|
||||
|
||||
// PATCH /api/businesses/[id]
|
||||
export async function PATCH(request: NextRequest, { params }: Params) {
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const body = await request.json()
|
||||
const business = await prisma.business.update({
|
||||
where: { id },
|
||||
@@ -42,9 +48,12 @@ export async function PATCH(request: NextRequest, { params }: Params) {
|
||||
}
|
||||
|
||||
// DELETE /api/businesses/[id]
|
||||
export async function DELETE(_request: NextRequest, { params }: Params) {
|
||||
export async function DELETE(
|
||||
_request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
await prisma.business.delete({ where: { id } })
|
||||
return NextResponse.json({ success: true })
|
||||
} catch (error) {
|
||||
|
||||
@@ -4,11 +4,11 @@ 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 }> }
|
||||
) {
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const userId = request.headers.get('x-user-id')
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const { archived } = await request.json()
|
||||
|
||||
if (!userId) {
|
||||
|
||||
@@ -4,11 +4,11 @@ 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 }> }
|
||||
) {
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const userId = request.headers.get('x-user-id')
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
|
||||
if (!userId) {
|
||||
return NextResponse.json({ error: 'Utilisateur non identifié' }, { status: 401 })
|
||||
@@ -36,6 +36,7 @@ export async function GET(
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
email: true,
|
||||
avatar: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ export async function GET(request: NextRequest) {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
email: true,
|
||||
avatar: true,
|
||||
role: true
|
||||
}
|
||||
|
||||
@@ -4,9 +4,12 @@ import prisma from '../../../../lib/prisma'
|
||||
type Params = { params: Promise<{ id: string }> }
|
||||
|
||||
// GET /api/interviews/[id]
|
||||
export async function GET(_request: NextRequest, { params }: Params) {
|
||||
export async function GET(
|
||||
_request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const interview = await prisma.interview.findUnique({ where: { id } })
|
||||
if (!interview) return NextResponse.json({ error: 'Non trouvé' }, { status: 404 })
|
||||
return NextResponse.json(interview)
|
||||
@@ -17,9 +20,12 @@ export async function GET(_request: NextRequest, { params }: Params) {
|
||||
}
|
||||
|
||||
// PATCH /api/interviews/[id]
|
||||
export async function PATCH(request: NextRequest, { params }: Params) {
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const body = await request.json()
|
||||
const interview = await prisma.interview.update({ where: { id }, data: body })
|
||||
return NextResponse.json(interview)
|
||||
@@ -30,9 +36,12 @@ export async function PATCH(request: NextRequest, { params }: Params) {
|
||||
}
|
||||
|
||||
// DELETE /api/interviews/[id]
|
||||
export async function DELETE(_request: NextRequest, { params }: Params) {
|
||||
export async function DELETE(
|
||||
_request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
await prisma.interview.delete({ where: { id } })
|
||||
return NextResponse.json({ success: true })
|
||||
} catch (error) {
|
||||
|
||||
@@ -4,11 +4,11 @@ import prisma from '../../../../../lib/prisma'
|
||||
// POST /api/messages/[id]/report — Report a message for moderation
|
||||
export async function POST(
|
||||
request: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const userId = request.headers.get('x-user-id')
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const { reason } = await request.json()
|
||||
|
||||
if (!userId) {
|
||||
|
||||
@@ -4,9 +4,12 @@ import prisma from '../../../../lib/prisma'
|
||||
type Params = { params: Promise<{ id: string }> }
|
||||
|
||||
// GET /api/offers/[id]
|
||||
export async function GET(_request: NextRequest, { params }: Params) {
|
||||
export async function GET(
|
||||
_request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const offer = await prisma.offer.findUnique({
|
||||
where: { id },
|
||||
include: { business: true },
|
||||
@@ -20,9 +23,12 @@ export async function GET(_request: NextRequest, { params }: Params) {
|
||||
}
|
||||
|
||||
// PATCH /api/offers/[id]
|
||||
export async function PATCH(request: NextRequest, { params }: Params) {
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
const body = await request.json()
|
||||
const offer = await prisma.offer.update({
|
||||
where: { id },
|
||||
@@ -37,9 +43,12 @@ export async function PATCH(request: NextRequest, { params }: Params) {
|
||||
}
|
||||
|
||||
// DELETE /api/offers/[id]
|
||||
export async function DELETE(_request: NextRequest, { params }: Params) {
|
||||
export async function DELETE(
|
||||
_request: NextRequest,
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const { id } = await params
|
||||
const { id } = await context.params
|
||||
await prisma.offer.delete({ where: { id } })
|
||||
return NextResponse.json({ success: true })
|
||||
} catch (error) {
|
||||
|
||||
@@ -2,7 +2,10 @@ import { NextRequest, NextResponse } from 'next/server'
|
||||
import prisma from '../../../../lib/prisma'
|
||||
|
||||
// PATCH /api/users/me — Update personal user profile
|
||||
export async function PATCH(request: NextRequest) {
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
context: { params: Promise<any> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const userId = request.headers.get('x-user-id')
|
||||
const data = await request.json()
|
||||
|
||||
@@ -17,7 +17,10 @@ export async function GET(request: NextRequest) {
|
||||
name: true,
|
||||
email: true,
|
||||
role: true,
|
||||
avatar: true
|
||||
avatar: true,
|
||||
phone: true,
|
||||
bio: true,
|
||||
location: true
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect, Suspense } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { LayoutDashboard, Edit3, ShoppingBag, CreditCard, LogOut, Eye, MessageSquare, User as UserIcon, Rocket, ShieldAlert } from 'lucide-react';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
@@ -15,7 +15,7 @@ import DashboardOffers from '../../components/dashboard/DashboardOffers';
|
||||
import PricingSection from '../../components/PricingSection';
|
||||
import { useUser } from '../../components/UserProvider';
|
||||
|
||||
const DashboardPage = () => {
|
||||
const DashboardContent = () => {
|
||||
const { user, logout } = useUser();
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
@@ -319,4 +319,16 @@ const DashboardPage = () => {
|
||||
);
|
||||
}
|
||||
|
||||
const DashboardPage = () => {
|
||||
return (
|
||||
<Suspense fallback={
|
||||
<div className="min-h-screen flex items-center justify-center bg-gray-50">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-brand-600"></div>
|
||||
</div>
|
||||
}>
|
||||
<DashboardContent />
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
||||
export default DashboardPage;
|
||||
|
||||
@@ -12,6 +12,7 @@ interface Message {
|
||||
createdAt: string;
|
||||
sender: {
|
||||
name: string;
|
||||
email?: string;
|
||||
avatar?: string;
|
||||
};
|
||||
}
|
||||
@@ -25,9 +26,11 @@ interface Conversation {
|
||||
ownerId: string;
|
||||
};
|
||||
participants: {
|
||||
isArchived: boolean;
|
||||
user: {
|
||||
id: string;
|
||||
name: string;
|
||||
email?: string;
|
||||
avatar?: string;
|
||||
};
|
||||
}[];
|
||||
|
||||
@@ -26,6 +26,10 @@ export const MOCK_BUSINESSES: Business[] = [
|
||||
},
|
||||
contactEmail: 'contact@afrotech.ci',
|
||||
contactPhone: '+225 07 07 07 07 07',
|
||||
showEmail: true,
|
||||
showPhone: true,
|
||||
showSocials: true,
|
||||
isActive: true,
|
||||
verified: true,
|
||||
viewCount: 1240,
|
||||
rating: 4.8,
|
||||
@@ -33,7 +37,6 @@ export const MOCK_BUSINESSES: Business[] = [
|
||||
// Featured Data
|
||||
isFeatured: true,
|
||||
founderName: 'Jean-Marc Kouassi',
|
||||
// UPDATED IMAGE: Profile of an Afro-descendant entrepreneur
|
||||
founderImageUrl: 'https://images.unsplash.com/photo-1531384441138-2736e62e0919?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80',
|
||||
keyMetric: '+50 Projets Livrés'
|
||||
},
|
||||
@@ -47,6 +50,10 @@ export const MOCK_BUSINESSES: Business[] = [
|
||||
logoUrl: 'https://picsum.photos/200/200?random=2',
|
||||
contactEmail: 'hello@baobabfoods.fr',
|
||||
contactPhone: '+33 6 12 34 56 78',
|
||||
showEmail: true,
|
||||
showPhone: true,
|
||||
showSocials: true,
|
||||
isActive: true,
|
||||
verified: true,
|
||||
viewCount: 850,
|
||||
rating: 4.9,
|
||||
@@ -64,6 +71,10 @@ export const MOCK_BUSINESSES: Business[] = [
|
||||
description: 'Création de tenues modernes utilisant le tissu Ankara authentique. Nous travaillons directement avec des tisserands locaux pour garantir une qualité exceptionnelle et une rémunération équitable. Exportation internationale et vente en ligne.',
|
||||
logoUrl: 'https://picsum.photos/200/200?random=3',
|
||||
contactEmail: 'sales@lagosfashion.ng',
|
||||
showEmail: true,
|
||||
showPhone: false,
|
||||
showSocials: false,
|
||||
isActive: true,
|
||||
verified: false,
|
||||
viewCount: 320,
|
||||
rating: 4.5,
|
||||
@@ -80,6 +91,10 @@ export const MOCK_BUSINESSES: Business[] = [
|
||||
logoUrl: 'https://picsum.photos/200/200?random=4',
|
||||
contactEmail: 'info@saharasolar.sn',
|
||||
contactPhone: '+221 77 000 00 00',
|
||||
showEmail: true,
|
||||
showPhone: true,
|
||||
showSocials: false,
|
||||
isActive: true,
|
||||
verified: true,
|
||||
viewCount: 560,
|
||||
rating: 4.7,
|
||||
@@ -98,6 +113,10 @@ export const MOCK_BUSINESSES: Business[] = [
|
||||
contactEmail: 'contact@nubianessence.cm',
|
||||
contactPhone: '+237 6 99 99 99 99',
|
||||
socialLinks: { instagram: 'https://instagram.com', facebook: 'https://facebook.com' },
|
||||
showEmail: true,
|
||||
showPhone: true,
|
||||
showSocials: true,
|
||||
isActive: true,
|
||||
verified: true,
|
||||
viewCount: 410,
|
||||
rating: 4.6,
|
||||
@@ -117,6 +136,10 @@ export const MOCK_BUSINESSES: Business[] = [
|
||||
contactEmail: 'admissions@kijani.ke',
|
||||
contactPhone: '+254 700 000 000',
|
||||
socialLinks: { linkedin: 'https://linkedin.com', website: 'https://kijani.ke' },
|
||||
showEmail: true,
|
||||
showPhone: true,
|
||||
showSocials: true,
|
||||
isActive: true,
|
||||
verified: true,
|
||||
viewCount: 980,
|
||||
rating: 5.0,
|
||||
@@ -133,6 +156,10 @@ export const MOCK_BUSINESSES: Business[] = [
|
||||
description: 'La solution de paiement agrégée pour les e-commerçants en RDC. Acceptez M-Pesa, Orange Money, Airtel Money et les cartes Visa/Mastercard via une API unique et sécurisée.',
|
||||
logoUrl: 'https://picsum.photos/200/200?random=7',
|
||||
contactEmail: 'biz@payna.cd',
|
||||
showEmail: true,
|
||||
showPhone: false,
|
||||
showSocials: false,
|
||||
isActive: true,
|
||||
verified: false,
|
||||
viewCount: 230,
|
||||
rating: 4.2,
|
||||
@@ -150,6 +177,10 @@ export const MOCK_BUSINESSES: Business[] = [
|
||||
contactEmail: 'projet@ecobati.bj',
|
||||
contactPhone: '+229 97 00 00 00',
|
||||
socialLinks: { instagram: 'https://instagram.com', website: 'https://ecobati.bj' },
|
||||
showEmail: true,
|
||||
showPhone: true,
|
||||
showSocials: true,
|
||||
isActive: true,
|
||||
verified: true,
|
||||
viewCount: 670,
|
||||
rating: 4.8,
|
||||
|
||||
2
next-env.d.ts
vendored
2
next-env.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
import "./.next/types/routes.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
Reference in New Issue
Block a user