refactor: create album users (#9315)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ArrayNotEmpty, IsEnum, IsString } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { ArrayNotEmpty, IsArray, IsEnum, IsString, ValidateNested } from 'class-validator';
|
||||
import _ from 'lodash';
|
||||
import { PropertyLifecycle } from 'src/decorators';
|
||||
import { AssetResponseDto, mapAsset } from 'src/dtos/asset-response.dto';
|
||||
@@ -32,6 +33,14 @@ export class AddUsersDto {
|
||||
albumUsers!: AlbumUserAddDto[];
|
||||
}
|
||||
|
||||
class AlbumUserCreateDto {
|
||||
@ValidateUUID()
|
||||
userId!: string;
|
||||
|
||||
@IsEnum(AlbumUserRole)
|
||||
role!: AlbumUserRole;
|
||||
}
|
||||
|
||||
export class CreateAlbumDto {
|
||||
@IsString()
|
||||
@ApiProperty()
|
||||
@@ -41,7 +50,15 @@ export class CreateAlbumDto {
|
||||
@Optional()
|
||||
description?: string;
|
||||
|
||||
@Optional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => AlbumUserCreateDto)
|
||||
@PropertyLifecycle({ addedAt: 'v1.104.0' })
|
||||
albumUsers?: AlbumUserCreateDto[];
|
||||
|
||||
@ValidateUUID({ optional: true, each: true })
|
||||
@PropertyLifecycle({ deprecatedAt: 'v1.104.0' })
|
||||
sharedWithUserIds?: string[];
|
||||
|
||||
@ValidateUUID({ optional: true, each: true })
|
||||
|
||||
Reference in New Issue
Block a user