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:
Min Idzelis
2025-06-15 02:22:37 +00:00
parent b3d080f6e8
commit 6f2f295cf3
2 changed files with 10 additions and 2 deletions

View File

@@ -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> {

View File

@@ -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