order by updated_at

pull/3415/head
Sander Hahn 6 years ago
parent 2e23c7a684
commit bc8b78ff27

@ -12,10 +12,14 @@ export async function get(req, res) {
const offset = req.query.offset || 0;
const rows = await query(`
select g.uid, g.name, coalesce(g.updated_at, g.created_at) as updated_at
select
g.uid,
g.name,
coalesce(g.updated_at, g.created_at) as updated_at,
g.created_at
from gists g
where g.user_id = $1
order by g.updated_at desc, g.created_at desc
order by coalesce(g.updated_at, g.created_at) desc
limit 20
offset $2
`, [user.id, offset]);

Loading…
Cancel
Save