mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
86 lines
1.5 KiB
SQL
86 lines
1.5 KiB
SQL
-- NOTE: This file is auto generated by ./sql-generator
|
|
|
|
-- SessionRepository.get
|
|
select
|
|
"id",
|
|
"expiresAt",
|
|
"pinExpiresAt"
|
|
from
|
|
"session"
|
|
where
|
|
"id" = $1
|
|
|
|
-- SessionRepository.getByToken
|
|
select
|
|
"session"."id",
|
|
"session"."isPendingSyncReset",
|
|
"session"."updatedAt",
|
|
"session"."pinExpiresAt",
|
|
(
|
|
select
|
|
to_json(obj)
|
|
from
|
|
(
|
|
select
|
|
"user"."id",
|
|
"user"."name",
|
|
"user"."email",
|
|
"user"."isAdmin",
|
|
"user"."quotaUsageInBytes",
|
|
"user"."quotaSizeInBytes"
|
|
from
|
|
"user"
|
|
where
|
|
"user"."id" = "session"."userId"
|
|
and "user"."deletedAt" is null
|
|
) as obj
|
|
) as "user"
|
|
from
|
|
"session"
|
|
where
|
|
"session"."token" = $1
|
|
and (
|
|
"session"."expiresAt" is null
|
|
or "session"."expiresAt" > $2
|
|
)
|
|
|
|
-- SessionRepository.getByUserId
|
|
select
|
|
"session".*
|
|
from
|
|
"session"
|
|
inner join "user" on "user"."id" = "session"."userId"
|
|
and "user"."deletedAt" is null
|
|
where
|
|
"session"."userId" = $1
|
|
and (
|
|
"session"."expiresAt" is null
|
|
or "session"."expiresAt" > $2
|
|
)
|
|
order by
|
|
"session"."updatedAt" desc,
|
|
"session"."createdAt" desc
|
|
|
|
-- SessionRepository.delete
|
|
delete from "session"
|
|
where
|
|
"id" = $1::uuid
|
|
|
|
-- SessionRepository.lockAll
|
|
update "session"
|
|
set
|
|
"pinExpiresAt" = $1
|
|
where
|
|
"userId" = $2
|
|
|
|
-- SessionRepository.resetSyncProgress
|
|
begin
|
|
update "session"
|
|
set
|
|
"isPendingSyncReset" = $1
|
|
where
|
|
"id" = $2
|
|
delete from "session_sync_checkpoint"
|
|
where
|
|
"sessionId" = $1
|
|
commit
|