mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
* fix remove assets from shared link * rename var * test: should remove individually shared asset * test: should share individually assets * fix failing tests
18 lines
571 B
TypeScript
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);
|
|
}
|
|
}
|