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

@ -1,13 +1,9 @@
import { ApiProperty } from '@nestjs/swagger';
import { ArrayMaxSize, ArrayUnique, IsEnum, IsNotEmpty, IsString } from 'class-validator';
import { LibraryEntity, LibraryType } from 'src/entities/library.entity';
import { ArrayMaxSize, ArrayUnique, IsNotEmpty, IsString } from 'class-validator';
import { LibraryEntity } from 'src/entities/library.entity';
import { Optional, ValidateBoolean, ValidateUUID } from 'src/validation';
export class CreateLibraryDto {
@IsEnum(LibraryType)
@ApiProperty({ enumName: 'LibraryType', enum: LibraryType })
type!: LibraryType;
@ValidateUUID()
ownerId!: string;
@ -97,21 +93,11 @@ export class ScanLibraryDto {
refreshAllFiles?: boolean;
}
export class SearchLibraryDto {
@IsEnum(LibraryType)
@ApiProperty({ enumName: 'LibraryType', enum: LibraryType })
@Optional()
type?: LibraryType;
}
export class LibraryResponseDto {
id!: string;
ownerId!: string;
name!: string;
@ApiProperty({ enumName: 'LibraryType', enum: LibraryType })
type!: LibraryType;
@ApiProperty({ type: 'integer' })
assetCount!: number;
@ -146,7 +132,6 @@ export function mapLibrary(entity: LibraryEntity): LibraryResponseDto {
return {
id: entity.id,
ownerId: entity.ownerId,
type: entity.type,
name: entity.name,
createdAt: entity.createdAt,
updatedAt: entity.updatedAt,