mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor: enum casing (#19946)
This commit is contained in:
parent
920d7de349
commit
e73abe0762
174 changed files with 2675 additions and 2459 deletions
|
|
@ -17,7 +17,7 @@ export class StackService extends BaseService {
|
|||
}
|
||||
|
||||
async create(auth: AuthDto, dto: StackCreateDto): Promise<StackResponseDto> {
|
||||
await this.requireAccess({ auth, permission: Permission.ASSET_UPDATE, ids: dto.assetIds });
|
||||
await this.requireAccess({ auth, permission: Permission.AssetUpdate, ids: dto.assetIds });
|
||||
|
||||
const stack = await this.stackRepository.create({ ownerId: auth.user.id }, dto.assetIds);
|
||||
|
||||
|
|
@ -27,13 +27,13 @@ export class StackService extends BaseService {
|
|||
}
|
||||
|
||||
async get(auth: AuthDto, id: string): Promise<StackResponseDto> {
|
||||
await this.requireAccess({ auth, permission: Permission.STACK_READ, ids: [id] });
|
||||
await this.requireAccess({ auth, permission: Permission.StackRead, ids: [id] });
|
||||
const stack = await this.findOrFail(id);
|
||||
return mapStack(stack, { auth });
|
||||
}
|
||||
|
||||
async update(auth: AuthDto, id: string, dto: StackUpdateDto): Promise<StackResponseDto> {
|
||||
await this.requireAccess({ auth, permission: Permission.STACK_UPDATE, ids: [id] });
|
||||
await this.requireAccess({ auth, permission: Permission.StackUpdate, ids: [id] });
|
||||
const stack = await this.findOrFail(id);
|
||||
if (dto.primaryAssetId && !stack.assets.some(({ id }) => id === dto.primaryAssetId)) {
|
||||
throw new BadRequestException('Primary asset must be in the stack');
|
||||
|
|
@ -47,13 +47,13 @@ export class StackService extends BaseService {
|
|||
}
|
||||
|
||||
async delete(auth: AuthDto, id: string): Promise<void> {
|
||||
await this.requireAccess({ auth, permission: Permission.STACK_DELETE, ids: [id] });
|
||||
await this.requireAccess({ auth, permission: Permission.StackDelete, ids: [id] });
|
||||
await this.stackRepository.delete(id);
|
||||
await this.eventRepository.emit('StackDelete', { stackId: id, userId: auth.user.id });
|
||||
}
|
||||
|
||||
async deleteAll(auth: AuthDto, dto: BulkIdsDto): Promise<void> {
|
||||
await this.requireAccess({ auth, permission: Permission.STACK_DELETE, ids: dto.ids });
|
||||
await this.requireAccess({ auth, permission: Permission.StackDelete, ids: dto.ids });
|
||||
await this.stackRepository.deleteAll(dto.ids);
|
||||
await this.eventRepository.emit('StackDeleteAll', { stackIds: dto.ids, userId: auth.user.id });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue