refactor: library type (#9525)

This commit is contained in:
Jason Rasmussen 2024-05-20 18:09:10 -04:00 committed by GitHub
parent 4353153fe6
commit 84d824d6a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 183 additions and 984 deletions

View file

@ -274,7 +274,7 @@ export class AccessCore {
}
case Permission.ASSET_UPLOAD: {
return await this.repository.library.checkOwnerAccess(auth.user.id, ids);
return ids.has(auth.user.id) ? new Set([auth.user.id]) : new Set<string>();
}
case Permission.ARCHIVE_READ: {

View file

@ -2,7 +2,6 @@ import { BadRequestException, ForbiddenException } from '@nestjs/common';
import sanitize from 'sanitize-filename';
import { SALT_ROUNDS } from 'src/constants';
import { UserResponseDto } from 'src/dtos/user.dto';
import { LibraryType } from 'src/entities/library.entity';
import { UserEntity } from 'src/entities/user.entity';
import { ICryptoRepository } from 'src/interfaces/crypto.interface';
import { ILibraryRepository } from 'src/interfaces/library.interface';
@ -93,16 +92,7 @@ export class UserCore {
if (payload.storageLabel) {
payload.storageLabel = sanitize(payload.storageLabel.replaceAll('.', ''));
}
const userEntity = await this.userRepository.create(payload);
await this.libraryRepository.create({
owner: { id: userEntity.id } as UserEntity,
name: 'Default Library',
assets: [],
type: LibraryType.UPLOAD,
importPaths: [],
exclusionPatterns: [],
});
return userEntity;
return this.userRepository.create(payload);
}
}