refactor: create album users (#9315)

This commit is contained in:
Jason Rasmussen 2024-05-07 16:38:09 -04:00 committed by GitHub
parent e9f99673b9
commit e79d1b1ec2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 267 additions and 52 deletions

View file

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