mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-25 19:27:55 +00:00
129 lines
2.7 KiB
TypeScript
129 lines
2.7 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import {
|
|
IsBoolean,
|
|
IsNotEmpty,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
import { AddSubspaceDto } from './subspace';
|
|
import { CreateTagDto } from './tag';
|
|
|
|
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: 'Icon identifier for the space',
|
|
example: 'assets/location',
|
|
required: false,
|
|
})
|
|
@IsString()
|
|
@IsOptional()
|
|
public icon?: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Indicates whether the space is private or public',
|
|
example: false,
|
|
default: false,
|
|
})
|
|
@IsBoolean()
|
|
isPrivate: boolean;
|
|
|
|
@ApiProperty({ description: 'X position on canvas', example: 120 })
|
|
@IsNumber()
|
|
x: number;
|
|
|
|
@ApiProperty({ description: 'Y position on canvas', example: 200 })
|
|
@IsNumber()
|
|
y: number;
|
|
|
|
@ApiProperty({
|
|
description: 'UUID of the Space',
|
|
example: 'd290f1ee-6c54-4b01-90e6-d701748f0851',
|
|
})
|
|
@IsString()
|
|
@IsOptional()
|
|
spaceModelUuid?: string;
|
|
|
|
@ApiProperty({ description: 'Y position on canvas', example: 200 })
|
|
@IsString()
|
|
@IsOptional()
|
|
direction?: string;
|
|
|
|
@ApiProperty({
|
|
description: 'List of subspaces included in the model',
|
|
type: [AddSubspaceDto],
|
|
})
|
|
@IsOptional()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => AddSubspaceDto)
|
|
subspaces?: AddSubspaceDto[];
|
|
|
|
@ApiProperty({
|
|
description: 'List of tags associated with the space model',
|
|
type: [CreateTagDto],
|
|
})
|
|
@ValidateNested({ each: true })
|
|
@Type(() => CreateTagDto)
|
|
tags?: CreateTagDto[];
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|