fix: clean error

This commit is contained in:
devthejo 2025-06-30 13:47:53 +02:00
parent 11943b667c
commit 391fd6d380

View file

@ -28,22 +28,22 @@ module.exports = ({ services: { sortRolesByLevel, signJwt } }) => {
let deviceId let deviceId
let roles let roles
try { const [row] = await sql`
const [row] = await sql` SELECT
SELECT "user_id" as "userId",
"user_id" as "userId", "device_id" as "deviceId"
"device_id" as "deviceId" FROM
FROM "auth_token"
"auth_token" WHERE
WHERE "auth_token" = ${authToken}
"auth_token" = ${authToken} `
` if (!row) {
userId = row.userId
deviceId = row.deviceId
} catch (e) {
throw httpError(410, "Auth token not found") throw httpError(410, "Auth token not found")
} }
userId = row.userId
deviceId = row.deviceId
if (!userId) { if (!userId) {
await sql.begin(async (sql) => { await sql.begin(async (sql) => {
await sql`set constraints all deferred` await sql`set constraints all deferred`