Maj taxonomies
Some checks failed
Build and Push App / build (push) Failing after 11m28s

maj url photo
+ page 404
+ gestion programmation d'article
This commit is contained in:
2026-05-03 21:22:12 +02:00
parent 0e72867d4c
commit 5f421b418e
41 changed files with 1946 additions and 735 deletions

View File

@@ -6,6 +6,12 @@ import { generateSlug } from '@/lib/utils'
export async function GET() {
try {
const posts = await prisma.blogPost.findMany({
where: {
status: 'PUBLISHED',
publishedAt: {
lte: new Date()
}
},
orderBy: { date: 'desc' },
})
return NextResponse.json(posts)

View File

@@ -5,11 +5,6 @@ import { USER_SAFE_SELECT, getAuthUser } from '@/lib/auth-utils'
// GET /api/businesses — List all businesses (Mock + DB)
export async function GET(request: NextRequest) {
try {
const user = await getAuthUser(request)
if (!user) {
return NextResponse.json({ error: 'Authentification requise' }, { status: 401 })
}
const { searchParams } = new URL(request.url)
const category = searchParams.get('category')
const q = searchParams.get('q')?.toLowerCase()

View File

@@ -5,6 +5,12 @@ import prisma from '@/lib/prisma'
export async function GET() {
try {
const interviews = await prisma.interview.findMany({
where: {
status: 'PUBLISHED',
publishedAt: {
lte: new Date()
}
},
orderBy: { date: 'desc' },
})
return NextResponse.json(interviews)

20
app/api/tags/route.ts Normal file
View File

@@ -0,0 +1,20 @@
import { NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';
export async function GET() {
try {
const blogPosts = await prisma.blogPost.findMany({ select: { tags: true } });
const interviews = await prisma.interview.findMany({ select: { tags: true } });
const events = await prisma.event.findMany({ select: { tags: true } });
const businesses = await prisma.business.findMany({ select: { tags: true } });
const allTags = new Set<string>();
[...blogPosts, ...interviews, ...events, ...businesses].forEach(item => {
item.tags.forEach(tag => allTags.add(tag.toLowerCase()));
});
return NextResponse.json(Array.from(allTags).sort());
} catch (error) {
return NextResponse.json({ error: 'Failed to fetch tags' }, { status: 500 });
}
}