immich/server/src/repositories/shared-link-asset.repository.ts
Jorge Montejo a23dfff6cf
fix: remove assets from shared link (#22935)
* fix remove assets from shared link

* rename var

* test: should remove individually shared asset

* test: should share individually assets

* fix failing tests
2025-10-16 15:03:41 -04:00

18 lines
571 B
TypeScript

import { Kysely } from 'kysely';
import { InjectKysely } from 'nestjs-kysely';
import { DB } from 'src/schema';
export class SharedLinkAssetRepository {
constructor(@InjectKysely() private db: Kysely<DB>) {}
async remove(sharedLinkId: string, assetsId: string[]) {
const deleted = await this.db
.deleteFrom('shared_link_asset')
.where('shared_link_asset.sharedLinksId', '=', sharedLinkId)
.where('shared_link_asset.assetsId', 'in', assetsId)
.returning('assetsId')
.execute();
return deleted.map((row) => row.assetsId);
}
}