mirror of
https://github.com/immich-app/immich.git
synced 2026-02-04 17:01:13 +03:00
refactor(server): clean up asset repository and add getTrashedIds method
- Remove redundant return statement in asset repository update method - Add getTrashedIds method to trash repository for retrieving trashed asset IDs by user
This commit is contained in:
@@ -443,8 +443,6 @@ export class AssetRepository {
|
||||
.$call((qb) => qb.select(withFacesAndPeople))
|
||||
.executeTakeFirst();
|
||||
}
|
||||
|
||||
return this.getById(asset.id, { exifInfo: true, faces: { person: true } });
|
||||
}
|
||||
|
||||
async remove(asset: { id: string }): Promise<void> {
|
||||
|
||||
@@ -11,6 +11,16 @@ export class TrashRepository {
|
||||
return this.db.selectFrom('assets').select(['id']).where('status', '=', AssetStatus.DELETED).stream();
|
||||
}
|
||||
|
||||
@GenerateSql({ params: [DummyValue.UUID] })
|
||||
getTrashedIds(userId: string): AsyncIterableIterator<{ id: string }> {
|
||||
return this.db
|
||||
.selectFrom('assets')
|
||||
.select(['id'])
|
||||
.where('ownerId', '=', userId)
|
||||
.where('status', '=', AssetStatus.TRASHED)
|
||||
.stream();
|
||||
}
|
||||
|
||||
@GenerateSql({ params: [DummyValue.UUID] })
|
||||
async restore(userId: string): Promise<number> {
|
||||
const { numUpdatedRows } = await this.db
|
||||
|
||||
Reference in New Issue
Block a user