mirror of
https://github.com/immich-app/immich.git
synced 2025-12-28 17:24:56 +03:00
refactor(server): stack owner (#10900)
This commit is contained in:
@@ -3,7 +3,7 @@ import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { StackEntity } from 'src/entities/stack.entity';
|
||||
import { IStackRepository } from 'src/interfaces/stack.interface';
|
||||
import { Instrumentation } from 'src/utils/instrumentation';
|
||||
import { In, Repository } from 'typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Instrumentation()
|
||||
@Injectable()
|
||||
@@ -34,13 +34,6 @@ export class StackRepository implements IStackRepository {
|
||||
});
|
||||
}
|
||||
|
||||
async deleteAll(userId: string): Promise<void> {
|
||||
// TODO add owner to stack entity
|
||||
const stacks = await this.repository.find({ where: { primaryAsset: { ownerId: userId } } });
|
||||
const stackIds = new Set(stacks.map((stack) => stack.id));
|
||||
await this.repository.delete({ id: In([...stackIds]) });
|
||||
}
|
||||
|
||||
private async save(entity: Partial<StackEntity>) {
|
||||
const { id } = await this.repository.save(entity);
|
||||
return this.repository.findOneOrFail({
|
||||
|
||||
Reference in New Issue
Block a user