fixed GET article route
This commit is contained in:
parent
561404faf1
commit
02278a99d9
@ -59,11 +59,14 @@ export const blogRoutes = (fastify, _, done) => {
|
|||||||
querystring: {
|
querystring: {
|
||||||
id: {
|
id: {
|
||||||
type: "string"
|
type: "string"
|
||||||
|
},
|
||||||
|
slug: {
|
||||||
|
type: "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, async (req, reply) => {
|
}, 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({
|
reply.send({
|
||||||
success: true,
|
success: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user