mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor: create album users (#9315)
This commit is contained in:
parent
e9f99673b9
commit
e79d1b1ec2
18 changed files with 267 additions and 52 deletions
|
|
@ -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 })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue