mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 20:14:54 +00:00
* refactor: reducing used queries on get communities (#385) * refactor: fix create space logic (#394) * Remove unique constraint on subspace and product in SubspaceProductAllocationEntity; update product relation to nullable in NewTagEntity * refactor: fix create space logic * device model updated to include the fixes and final columns * updated space models to include suggested fixes, update final logic and column names * task: removing old references of the old tag-product relation * task: remove old use of tags * task: remove old tag & tag model usage * refactor: delete space * task: remove unused functions * fix lint rule
77 lines
1.8 KiB
TypeScript
77 lines
1.8 KiB
TypeScript
import { ORPHAN_SPACE_NAME } from '@app/common/constants/orphan-constant';
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import {
|
|
IsArray,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
NotEquals,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
import { ModifySubspaceDto } from './subspace';
|
|
import { ModifyTagDto } from './tag/modify-tag.dto';
|
|
|
|
export class UpdateSpaceDto {
|
|
@ApiProperty({
|
|
description: 'Updated name of the space ',
|
|
example: 'New Space Name',
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
@NotEquals(ORPHAN_SPACE_NAME, {
|
|
message() {
|
|
return `Space name cannot be "${ORPHAN_SPACE_NAME}". Please choose a different name.`;
|
|
},
|
|
})
|
|
spaceName?: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Icon identifier for the space',
|
|
example: 'assets/location',
|
|
required: false,
|
|
})
|
|
@IsString()
|
|
@IsOptional()
|
|
public icon?: string;
|
|
|
|
@ApiProperty({ description: 'X position on canvas', example: 120 })
|
|
@IsNumber()
|
|
@IsOptional()
|
|
x?: number;
|
|
|
|
@ApiProperty({ description: 'Y position on canvas', example: 200 })
|
|
@IsNumber()
|
|
@IsOptional()
|
|
y?: number;
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'List of subspace modifications (add/update/delete)',
|
|
type: [ModifySubspaceDto],
|
|
})
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => ModifySubspaceDto)
|
|
subspaces?: ModifySubspaceDto[];
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
'List of tag modifications (add/update/delete) for the space model',
|
|
type: [ModifyTagDto],
|
|
})
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => ModifyTagDto)
|
|
tags?: ModifyTagDto[];
|
|
|
|
@ApiProperty({
|
|
description: 'UUID of the Space',
|
|
example: 'd290f1ee-6c54-4b01-90e6-d701748f0851',
|
|
})
|
|
@IsString()
|
|
@IsOptional()
|
|
spaceModelUuid?: string;
|
|
}
|