Compare commits

...

2 commits

Author SHA1 Message Date
2518ced0fa fix: wip
Some checks are pending
/ deploy (push) Blocked by required conditions
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Has started running
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Successful in 1m40s
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Successful in 2m35s
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Successful in 2m27s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Successful in 2m24s
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 1m52s
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 2m29s
2025-06-30 13:50:26 +02:00
391fd6d380 fix: clean error 2025-06-30 13:47:53 +02:00

View file

@ -10,7 +10,7 @@ module.exports = ({ services: { sortRolesByLevel, signJwt } }) => {
const { claimsNamespace, jwtExpirationInHours } = config const { claimsNamespace, jwtExpirationInHours } = config
async function validateAuthToken(authTokenJwt) { function validateAuthToken(authTokenJwt) {
try { try {
const { authToken } = jwtDecode(authTokenJwt) const { authToken } = jwtDecode(authTokenJwt)
return authToken return authToken
@ -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`