make db queries more selective

This commit is contained in:
CaptOrb 2025-09-10 14:00:18 +01:00
parent e2509f3e18
commit 8f64ee83f8

View File

@ -43,9 +43,9 @@ class UserRepository {
): Promise<User> { ): Promise<User> {
const result = await pool.query( const result = await pool.query(
`INSERT INTO users `INSERT INTO users
(forge_id, forge_user_id, access_token, token_expires_at) (forge_id, forge_user_id, access_token, token_expires_at)
VALUES ($1, $2, $3, $4) VALUES ($1, $2, $3, $4)
RETURNING *`, RETURNING user_id, forge_id, forge_user_id`,
[forgeId, forgeUserId, access_token, token_expires_at], [forgeId, forgeUserId, access_token, token_expires_at],
); );
return result.rows[0]; return result.rows[0];
@ -66,7 +66,7 @@ class UserRepository {
DO UPDATE SET DO UPDATE SET
access_token = EXCLUDED.access_token, access_token = EXCLUDED.access_token,
token_expires_at = EXCLUDED.token_expires_at token_expires_at = EXCLUDED.token_expires_at
RETURNING *`, RETURNING user_id, forge_id, forge_user_id, access_token, token_expires_at`,
[forgeId, forgeUserId, access_token, token_expires_at], [forgeId, forgeUserId, access_token, token_expires_at],
); );