2023-06-19 19:40:24 +00:00
|
|
|
import models from '../../api/models'
|
|
|
|
|
|
|
|
export default async (_, res) => {
|
|
|
|
// get the latest daily discussion thread
|
|
|
|
// this should probably be made more generic
|
|
|
|
// eg if the title changes this will break
|
|
|
|
// ... but this will need to change when we have more subs anyway
|
2023-07-26 16:01:31 +00:00
|
|
|
const [{ id }] = await models.$queryRawUnsafe(`
|
2023-06-19 19:40:24 +00:00
|
|
|
SELECT id
|
|
|
|
FROM "Item"
|
|
|
|
WHERE "pinId" IS NOT NULL
|
2023-09-13 01:21:16 +00:00
|
|
|
AND title = 'Stacker Saloon'
|
2023-06-19 19:40:24 +00:00
|
|
|
ORDER BY created_at DESC
|
|
|
|
LIMIT 1`)
|
|
|
|
|
|
|
|
res.redirect(`/items/${id}`)
|
|
|
|
}
|