feat: implement home page, business directory, and administrative management features with updated schema and API routes
Some checks failed
Build and Push App / build (push) Failing after 51s
Some checks failed
Build and Push App / build (push) Failing after 51s
This commit is contained in:
@@ -18,7 +18,17 @@ export async function GET(request: NextRequest) {
|
||||
isSuspended: false
|
||||
}
|
||||
}
|
||||
if (category && category !== 'All') where.category = category
|
||||
if (category && category !== 'All') {
|
||||
// Robust check: IDs are usually alphanumeric and long, without spaces or special chars
|
||||
// Names like "Agriculture & Agrobusiness" have spaces or special chars.
|
||||
const isId = /^[a-z0-9-]+$/.test(category) && category.length > 20;
|
||||
|
||||
if (isId) {
|
||||
where.categoryId = category
|
||||
} else {
|
||||
where.category = category
|
||||
}
|
||||
}
|
||||
if (featured === 'true') where.isFeatured = true
|
||||
if (countryId) where.countryId = countryId
|
||||
if (q) {
|
||||
@@ -61,6 +71,8 @@ export async function POST(request: NextRequest) {
|
||||
name: data.name || "",
|
||||
slug: data.slug || null,
|
||||
category: data.category || "Autre",
|
||||
categoryId: (data.categoryId && data.categoryId !== 'Autre') ? data.categoryId : null,
|
||||
suggestedCategory: data.suggestedCategory || null,
|
||||
location: data.location || "",
|
||||
countryId: data.countryId || null,
|
||||
city: data.city || "",
|
||||
|
||||
Reference in New Issue
Block a user