mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(server): tighten asset visibility (#18699)
* tighten visibility * update sql * elevated access util function * fix potential sync issue * include in user stats * include hidden assets in size usage * filter visibility in search duplicates query * stack visibility
This commit is contained in:
parent
b5c3a675b2
commit
fa22e865a4
21 changed files with 132 additions and 107 deletions
|
|
@ -153,17 +153,12 @@ export function toJson<DB, TB extends keyof DB & string, T extends TB | Expressi
|
|||
}
|
||||
|
||||
export const ASSET_CHECKSUM_CONSTRAINT = 'UQ_assets_owner_checksum';
|
||||
// TODO come up with a better query that only selects the fields we need
|
||||
|
||||
export function withDefaultVisibility<O>(qb: SelectQueryBuilder<DB, 'assets', O>) {
|
||||
return qb.where((qb) =>
|
||||
qb.or([
|
||||
qb('assets.visibility', '=', AssetVisibility.TIMELINE),
|
||||
qb('assets.visibility', '=', AssetVisibility.ARCHIVE),
|
||||
]),
|
||||
);
|
||||
return qb.where('assets.visibility', 'in', [sql.lit(AssetVisibility.ARCHIVE), sql.lit(AssetVisibility.TIMELINE)]);
|
||||
}
|
||||
|
||||
// TODO come up with a better query that only selects the fields we need
|
||||
export function withExif<O>(qb: SelectQueryBuilder<DB, 'assets', O>) {
|
||||
return qb
|
||||
.leftJoin('exif', 'assets.id', 'exif.assetId')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue