fixed GET article route
This commit is contained in:
parent
561404faf1
commit
02278a99d9
@ -59,11 +59,14 @@ export const blogRoutes = (fastify, _, done) => {
|
||||
querystring: {
|
||||
id: {
|
||||
type: "string"
|
||||
},
|
||||
slug: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, async (req, reply) => {
|
||||
const [result] = await db.select().from(articlesTable).where(or(eq(articlesTable.seo_slug, req.query.id), eq(articlesTable.id, req.query.id)));
|
||||
const [result] = await db.select().from(articlesTable).where((req.query.id ? eq(articlesTable.id, req.query.id) : eq(articlesTable.seo_slug, req.query.slug)));
|
||||
|
||||
reply.send({
|
||||
success: true,
|
||||
|
Loading…
Reference in New Issue
Block a user