Address follow-up review: cheaper avatars, list limits, less chatter.
Switch avatar resize to ApproxBiLinear, cap hunt/profile/admin list queries, drop redundant admin/profile lookups, dedupe CI on app PRs, and refresh stale todo.md notes.
This commit is contained in:
@@ -21,7 +21,8 @@ LEFT JOIN votes v ON v.question_id = q.id
|
||||
LEFT JOIN answers a ON a.question_id = q.id
|
||||
WHERE q.hunt_date = sqlc.arg(hunt_date) AND q.hidden = 0
|
||||
GROUP BY q.id, q.author_id, u.name, q.title, q.body, q.city, q.hunt_date, q.hidden, q.created_at, a.question_id
|
||||
ORDER BY score DESC, q.created_at ASC;
|
||||
ORDER BY score DESC, q.created_at ASC
|
||||
LIMIT sqlc.arg(row_limit);
|
||||
|
||||
-- name: GetQuestion :one
|
||||
SELECT q.id, q.author_id, u.name AS author_name, q.title, q.body, q.city, q.hunt_date, q.hidden, q.created_at,
|
||||
@@ -45,7 +46,8 @@ FROM questions q
|
||||
JOIN users u ON u.id = q.author_id
|
||||
LEFT JOIN answers a ON a.question_id = q.id
|
||||
WHERE q.author_id = sqlc.arg(author_id) AND q.hidden = 0
|
||||
ORDER BY q.created_at DESC;
|
||||
ORDER BY q.created_at DESC
|
||||
LIMIT sqlc.arg(row_limit);
|
||||
|
||||
-- name: ListQuestionsAnsweredBy :many
|
||||
SELECT q.id, q.author_id, u.name AS author_name, q.title, q.body, q.city, q.hunt_date, q.hidden, q.created_at,
|
||||
@@ -56,4 +58,5 @@ FROM answers ans
|
||||
JOIN questions q ON q.id = ans.question_id
|
||||
JOIN users u ON u.id = q.author_id
|
||||
WHERE ans.author_id = sqlc.arg(admin_id) AND q.hidden = 0
|
||||
ORDER BY ans.updated_at DESC;
|
||||
ORDER BY ans.updated_at DESC
|
||||
LIMIT sqlc.arg(row_limit);
|
||||
|
||||
@@ -15,7 +15,8 @@ WHERE username = $1;
|
||||
-- name: ListUsers :many
|
||||
SELECT id, username, name, role, avatar_url, state, created_at
|
||||
FROM users
|
||||
ORDER BY created_at ASC;
|
||||
ORDER BY created_at ASC
|
||||
LIMIT sqlc.arg(row_limit);
|
||||
|
||||
-- name: CountAdmins :one
|
||||
SELECT COUNT(*)::bigint AS count
|
||||
|
||||
Reference in New Issue
Block a user