refactor: enum casing (#19946)

This commit is contained in:
Jason Rasmussen 2025-07-15 14:50:13 -04:00 committed by GitHub
parent 920d7de349
commit e73abe0762
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
174 changed files with 2675 additions and 2459 deletions

View file

@ -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 });
}