add daily discussion thread permalink
This commit is contained in:
parent
3e4161ae8c
commit
cc6dc8c68b
|
@ -107,6 +107,10 @@ module.exports = withPWA({
|
|||
source: '/guide',
|
||||
destination: '/items/81862'
|
||||
},
|
||||
{
|
||||
source: '/daily',
|
||||
destination: '/api/daily'
|
||||
},
|
||||
{
|
||||
source: '/.well-known/lnurlp/:username',
|
||||
destination: '/api/lnurlp/:username'
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
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
|
||||
const [{ id }] = await models.$queryRaw(`
|
||||
SELECT id
|
||||
FROM "Item"
|
||||
WHERE "pinId" IS NOT NULL
|
||||
AND title = 'Daily discussion thread'
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 1`)
|
||||
|
||||
res.redirect(`/items/${id}`)
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
UPDATE users SET name = 'daily_squatter' WHERE name = 'daily';
|
||||
INSERT INTO "users" ("name") VALUES ('daily');
|
Loading…
Reference in New Issue