mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 20:04:54 +00:00
93 lines
1.7 KiB
TypeScript
93 lines
1.7 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import {
|
|
IsArray,
|
|
IsBoolean,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
|
|
export class AddSpaceDto {
|
|
@ApiProperty({
|
|
description: 'Name of the space (e.g., Floor 1, Unit 101)',
|
|
example: 'Unit 101',
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
spaceName: string;
|
|
|
|
@ApiProperty({
|
|
description: 'UUID of the parent space (if any, for hierarchical spaces)',
|
|
example: 'f5d7e9c3-44bc-4b12-88f1-1b3cda84752e',
|
|
required: false,
|
|
})
|
|
@IsUUID()
|
|
@IsOptional()
|
|
parentUuid?: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Indicates whether the space is private or public',
|
|
example: false,
|
|
default: false,
|
|
})
|
|
@IsBoolean()
|
|
isPrivate: boolean;
|
|
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => ProductAssignmentDto)
|
|
products: ProductAssignmentDto[];
|
|
}
|
|
|
|
export class AddUserSpaceDto {
|
|
@ApiProperty({
|
|
description: 'spaceUuid',
|
|
required: true,
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
public spaceUuid: string;
|
|
@ApiProperty({
|
|
description: 'userUuid',
|
|
required: true,
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
public userUuid: string;
|
|
constructor(dto: Partial<AddUserSpaceDto>) {
|
|
Object.assign(this, dto);
|
|
}
|
|
}
|
|
|
|
export class AddUserSpaceUsingCodeDto {
|
|
@ApiProperty({
|
|
description: 'userUuid',
|
|
required: true,
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
public userUuid: string;
|
|
@ApiProperty({
|
|
description: 'inviteCode',
|
|
required: true,
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
public inviteCode: string;
|
|
|
|
constructor(dto: Partial<AddUserSpaceDto>) {
|
|
Object.assign(this, dto);
|
|
}
|
|
}
|
|
|
|
class ProductAssignmentDto {
|
|
@IsNotEmpty()
|
|
productId: string;
|
|
|
|
@IsNotEmpty()
|
|
count: number;
|
|
}
|