Compare commits

...

8 Commits

Author SHA1 Message Date
Yaros fe0bdab6f1 chore: sync open-api 2026-05-31 18:50:18 +02:00
Yaros 474785e721 chore: remove album ownerId check 2026-05-31 18:44:24 +02:00
Yaros ea14b59741 Merge branch 'main' into fix/map-sidepanel-queries 2026-05-31 18:38:31 +02:00
Yaros f1ffdfe223 chore: add todos & warning 2026-04-30 19:48:57 +02:00
Yaros 44a77892f4 Merge branch 'main' into fix/map-sidepanel-queries 2026-04-28 19:58:44 +02:00
Yaros 31fb7f6aa8 Merge branch 'main' into fix/map-sidepanel-queries 2026-04-28 19:56:15 +02:00
Yaros 6cd33de1bb fix(server): assets not shown if partner timeline disabled 2026-04-12 13:57:35 +02:00
Yaros ac3eea80d2 fix(server/web): shared albums in map sidebar 2026-04-12 13:36:49 +02:00
7 changed files with 120 additions and 11 deletions
+24 -6
View File
@@ -67,9 +67,12 @@ class TimelineApi {
/// * [bool] withPartners:
/// Include assets shared by partners
///
/// * [bool] withSharedAlbums:
/// Include assets from shared albums (do not use!)
///
/// * [bool] withStacked:
/// Include stacked assets in the response. When true, only primary assets from stacks are returned.
Future<Response> getTimeBucketWithHttpInfo(String timeBucket, { String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, AssetOrderBy? orderBy, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withStacked, Future<void>? abortTrigger, }) async {
Future<Response> getTimeBucketWithHttpInfo(String timeBucket, { String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, AssetOrderBy? orderBy, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withSharedAlbums, bool? withStacked, Future<void>? abortTrigger, }) async {
// ignore: prefer_const_declarations
final apiPath = r'/timeline/bucket';
@@ -123,6 +126,9 @@ class TimelineApi {
if (withPartners != null) {
queryParams.addAll(_queryParams('', 'withPartners', withPartners));
}
if (withSharedAlbums != null) {
queryParams.addAll(_queryParams('', 'withSharedAlbums', withSharedAlbums));
}
if (withStacked != null) {
queryParams.addAll(_queryParams('', 'withStacked', withStacked));
}
@@ -191,10 +197,13 @@ class TimelineApi {
/// * [bool] withPartners:
/// Include assets shared by partners
///
/// * [bool] withSharedAlbums:
/// Include assets from shared albums (do not use!)
///
/// * [bool] withStacked:
/// Include stacked assets in the response. When true, only primary assets from stacks are returned.
Future<TimeBucketAssetResponseDto?> getTimeBucket(String timeBucket, { String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, AssetOrderBy? orderBy, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withStacked, Future<void>? abortTrigger, }) async {
final response = await getTimeBucketWithHttpInfo(timeBucket, albumId: albumId, bbox: bbox, isFavorite: isFavorite, isTrashed: isTrashed, key: key, order: order, orderBy: orderBy, personId: personId, slug: slug, tagId: tagId, userId: userId, visibility: visibility, withCoordinates: withCoordinates, withPartners: withPartners, withStacked: withStacked, abortTrigger: abortTrigger,);
Future<TimeBucketAssetResponseDto?> getTimeBucket(String timeBucket, { String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, AssetOrderBy? orderBy, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withSharedAlbums, bool? withStacked, Future<void>? abortTrigger, }) async {
final response = await getTimeBucketWithHttpInfo(timeBucket, albumId: albumId, bbox: bbox, isFavorite: isFavorite, isTrashed: isTrashed, key: key, order: order, orderBy: orderBy, personId: personId, slug: slug, tagId: tagId, userId: userId, visibility: visibility, withCoordinates: withCoordinates, withPartners: withPartners, withSharedAlbums: withSharedAlbums, withStacked: withStacked, abortTrigger: abortTrigger,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
@@ -256,9 +265,12 @@ class TimelineApi {
/// * [bool] withPartners:
/// Include assets shared by partners
///
/// * [bool] withSharedAlbums:
/// Include assets from shared albums (do not use!)
///
/// * [bool] withStacked:
/// Include stacked assets in the response. When true, only primary assets from stacks are returned.
Future<Response> getTimeBucketsWithHttpInfo({ String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, AssetOrderBy? orderBy, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withStacked, Future<void>? abortTrigger, }) async {
Future<Response> getTimeBucketsWithHttpInfo({ String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, AssetOrderBy? orderBy, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withSharedAlbums, bool? withStacked, Future<void>? abortTrigger, }) async {
// ignore: prefer_const_declarations
final apiPath = r'/timeline/buckets';
@@ -311,6 +323,9 @@ class TimelineApi {
if (withPartners != null) {
queryParams.addAll(_queryParams('', 'withPartners', withPartners));
}
if (withSharedAlbums != null) {
queryParams.addAll(_queryParams('', 'withSharedAlbums', withSharedAlbums));
}
if (withStacked != null) {
queryParams.addAll(_queryParams('', 'withStacked', withStacked));
}
@@ -376,10 +391,13 @@ class TimelineApi {
/// * [bool] withPartners:
/// Include assets shared by partners
///
/// * [bool] withSharedAlbums:
/// Include assets from shared albums (do not use!)
///
/// * [bool] withStacked:
/// Include stacked assets in the response. When true, only primary assets from stacks are returned.
Future<List<TimeBucketsResponseDto>?> getTimeBuckets({ String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, AssetOrderBy? orderBy, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withStacked, Future<void>? abortTrigger, }) async {
final response = await getTimeBucketsWithHttpInfo(albumId: albumId, bbox: bbox, isFavorite: isFavorite, isTrashed: isTrashed, key: key, order: order, orderBy: orderBy, personId: personId, slug: slug, tagId: tagId, userId: userId, visibility: visibility, withCoordinates: withCoordinates, withPartners: withPartners, withStacked: withStacked, abortTrigger: abortTrigger,);
Future<List<TimeBucketsResponseDto>?> getTimeBuckets({ String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, AssetOrderBy? orderBy, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withSharedAlbums, bool? withStacked, Future<void>? abortTrigger, }) async {
final response = await getTimeBucketsWithHttpInfo(albumId: albumId, bbox: bbox, isFavorite: isFavorite, isTrashed: isTrashed, key: key, order: order, orderBy: orderBy, personId: personId, slug: slug, tagId: tagId, userId: userId, visibility: visibility, withCoordinates: withCoordinates, withPartners: withPartners, withSharedAlbums: withSharedAlbums, withStacked: withStacked, abortTrigger: abortTrigger,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
+18
View File
@@ -13571,6 +13571,15 @@
"type": "boolean"
}
},
{
"name": "withSharedAlbums",
"required": false,
"in": "query",
"description": "Include assets from shared albums (do not use!)",
"schema": {
"type": "boolean"
}
},
{
"name": "withStacked",
"required": false,
@@ -13760,6 +13769,15 @@
"type": "boolean"
}
},
{
"name": "withSharedAlbums",
"required": false,
"in": "query",
"description": "Include assets from shared albums (do not use!)",
"schema": {
"type": "boolean"
}
},
{
"name": "withStacked",
"required": false,
+6 -2
View File
@@ -6317,7 +6317,7 @@ export function tagAssets({ id, bulkIdsDto }: {
/**
* Get time bucket
*/
export function getTimeBucket({ albumId, bbox, isFavorite, isTrashed, key, order, orderBy, personId, slug, tagId, timeBucket, userId, visibility, withCoordinates, withPartners, withStacked }: {
export function getTimeBucket({ albumId, bbox, isFavorite, isTrashed, key, order, orderBy, personId, slug, tagId, timeBucket, userId, visibility, withCoordinates, withPartners, withSharedAlbums, withStacked }: {
albumId?: string;
bbox?: string;
isFavorite?: boolean;
@@ -6333,6 +6333,7 @@ export function getTimeBucket({ albumId, bbox, isFavorite, isTrashed, key, order
visibility?: AssetVisibility;
withCoordinates?: boolean;
withPartners?: boolean;
withSharedAlbums?: boolean;
withStacked?: boolean;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
@@ -6354,6 +6355,7 @@ export function getTimeBucket({ albumId, bbox, isFavorite, isTrashed, key, order
visibility,
withCoordinates,
withPartners,
withSharedAlbums,
withStacked
}))}`, {
...opts
@@ -6362,7 +6364,7 @@ export function getTimeBucket({ albumId, bbox, isFavorite, isTrashed, key, order
/**
* Get time buckets
*/
export function getTimeBuckets({ albumId, bbox, isFavorite, isTrashed, key, order, orderBy, personId, slug, tagId, userId, visibility, withCoordinates, withPartners, withStacked }: {
export function getTimeBuckets({ albumId, bbox, isFavorite, isTrashed, key, order, orderBy, personId, slug, tagId, userId, visibility, withCoordinates, withPartners, withSharedAlbums, withStacked }: {
albumId?: string;
bbox?: string;
isFavorite?: boolean;
@@ -6377,6 +6379,7 @@ export function getTimeBuckets({ albumId, bbox, isFavorite, isTrashed, key, orde
visibility?: AssetVisibility;
withCoordinates?: boolean;
withPartners?: boolean;
withSharedAlbums?: boolean;
withStacked?: boolean;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
@@ -6397,6 +6400,7 @@ export function getTimeBuckets({ albumId, bbox, isFavorite, isTrashed, key, orde
visibility,
withCoordinates,
withPartners,
withSharedAlbums,
withStacked
}))}`, {
...opts
+2
View File
@@ -30,6 +30,8 @@ const TimeBucketQueryBaseSchema = z
'Filter by asset visibility status (ARCHIVE, TIMELINE, HIDDEN, LOCKED)',
),
withCoordinates: stringToBool.optional().describe('Include location data in the response'),
// TODO: Remove this after #12614 is resolved
withSharedAlbums: z.boolean().optional().describe('Include assets from shared albums (do not use!)'),
key: z.string().optional(),
slug: z.string().optional(),
bbox: z
+68 -2
View File
@@ -84,6 +84,7 @@ interface AssetBuilderOptions {
assetType?: AssetType;
visibility?: AssetVisibility;
withCoordinates?: boolean;
withSharedAlbums?: boolean;
bbox?: BoundingBox;
}
@@ -744,7 +745,40 @@ export class AssetRepository {
)
.where((eb) => eb.or([eb('asset.stackId', 'is', null), eb(eb.table('stack'), 'is not', null)])),
)
.$if(!!options.userIds, (qb) => qb.where('asset.ownerId', '=', anyUuid(options.userIds!)))
.$if(!!options.userIds, (qb) =>
qb.where((eb) =>
eb.or([
eb('asset.ownerId', '=', anyUuid(options.userIds!)),
// TODO: Rework, this is inefficient, temporary solution until #12614 is resolved
...(options.withSharedAlbums
? [
eb.exists(
eb
.selectFrom('album_asset')
.innerJoin('album', 'album.id', 'album_asset.albumId')
.whereRef('album_asset.assetId', '=', 'asset.id')
.where((eb) =>
eb.or([
eb.exists(
eb
.selectFrom('album_user')
.whereRef('album_user.albumId', '=', 'album.id')
.where('album_user.userId', '=', anyUuid(options.userIds!)),
),
eb.exists(
eb
.selectFrom('shared_link')
.whereRef('shared_link.albumId', '=', 'album.id')
.where('shared_link.userId', '=', anyUuid(options.userIds!)),
),
]),
),
),
]
: []),
]),
),
)
.$if(options.isFavorite !== undefined, (qb) => qb.where('asset.isFavorite', '=', options.isFavorite!))
.$if(!!options.assetType, (qb) => qb.where('asset.type', '=', options.assetType!))
.$if(options.isDuplicate !== undefined, (qb) =>
@@ -830,7 +864,39 @@ export class AssetRepository {
),
)
.$if(!!options.personId, (qb) => hasPeople(qb, [options.personId!]))
.$if(!!options.userIds, (qb) => qb.where('asset.ownerId', '=', anyUuid(options.userIds!)))
.$if(!!options.userIds, (qb) =>
qb.where((eb) =>
eb.or([
eb('asset.ownerId', '=', anyUuid(options.userIds!)),
...(options.withSharedAlbums
? [
eb.exists(
eb
.selectFrom('album_asset')
.innerJoin('album', 'album.id', 'album_asset.albumId')
.whereRef('album_asset.assetId', '=', 'asset.id')
.where((eb) =>
eb.or([
eb.exists(
eb
.selectFrom('album_user')
.whereRef('album_user.albumId', '=', 'album.id')
.where('album_user.userId', '=', anyUuid(options.userIds!)),
),
eb.exists(
eb
.selectFrom('shared_link')
.whereRef('shared_link.albumId', '=', 'album.id')
.where('shared_link.userId', '=', anyUuid(options.userIds!)),
),
]),
),
),
]
: []),
]),
),
)
.$if(options.isFavorite !== undefined, (qb) => qb.where('asset.isFavorite', '=', options.isFavorite!))
.$if(!!options.withStacked, (qb) =>
qb
+1 -1
View File
@@ -35,7 +35,7 @@ export class TimelineService extends BaseService {
const partnerIds = await getMyPartnerIds({
userId: auth.user.id,
repository: this.partnerRepository,
timelineEnabled: true,
timelineEnabled: dto.bbox === undefined, // ignore this option in map view
});
userIds.push(...partnerIds);
}
@@ -85,6 +85,7 @@
visibility: $mapSettings.includeArchived ? undefined : AssetVisibility.Timeline,
isFavorite: $mapSettings.onlyFavorites || undefined,
withPartners: $mapSettings.withPartners || undefined,
withSharedAlbums: $mapSettings.withSharedAlbums || undefined,
assetFilter: selectedClusterIds,
});