feat(server): add memories statistics resource (#19035)

This commit is contained in:
Jonathan Gilbert 2025-06-10 23:47:46 +10:00 committed by GitHub
parent 16745e77d4
commit e88bd74fd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 352 additions and 17 deletions

View file

@ -1,8 +1,33 @@
-- NOTE: This file is auto generated by ./sql-generator
-- MemoryRepository.statistics
select
count(*) as "total"
from
"memories"
where
"deletedAt" is null
and "ownerId" = $1
-- MemoryRepository.statistics (date filter)
select
count(*) as "total"
from
"memories"
where
(
"showAt" is null
or "showAt" <= $1
)
and (
"hideAt" is null
or "hideAt" >= $2
)
and "deletedAt" is null
and "ownerId" = $3
-- MemoryRepository.search
select
"memories".*,
(
select
coalesce(json_agg(agg), '[]')
@ -20,7 +45,8 @@ select
order by
"assets"."fileCreatedAt" asc
) as agg
) as "assets"
) as "assets",
"memories".*
from
"memories"
where
@ -31,7 +57,6 @@ order by
-- MemoryRepository.search (date filter)
select
"memories".*,
(
select
coalesce(json_agg(agg), '[]')
@ -49,7 +74,8 @@ select
order by
"assets"."fileCreatedAt" asc
) as agg
) as "assets"
) as "assets",
"memories".*
from
"memories"
where