-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7977 from ever-co/refactor/task-status-reorder
[Refactor] Task Status Re Order Logging
- Loading branch information
Showing
4 changed files
with
46 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Type } from 'class-transformer'; | ||
import { ArrayMinSize, IsArray, IsNotEmpty, IsNumber, IsUUID, ValidateNested } from 'class-validator'; | ||
import { IReorderDTO, IReorderRequestDTO } from '@gauzy/contracts'; | ||
import { ID, IReorderDTO, IReorderRequestDTO } from '@gauzy/contracts'; | ||
import { TenantOrganizationBaseDTO } from '../../../core/dto'; | ||
|
||
/** | ||
* DTO for individual reorder request item. | ||
*/ | ||
export class ReorderDTO implements IReorderDTO { | ||
@ApiProperty({ type: String, description: 'UUID of the record to reorder' }) | ||
@IsNotEmpty() // It should have a value | ||
@IsUUID() // Must be a UUID | ||
readonly id: string; | ||
@ApiProperty({ type: String, description: 'UUID of the record to reorder' }) | ||
@IsNotEmpty() // It should have a value | ||
@IsUUID() // Must be a UUID | ||
readonly id: ID; | ||
|
||
@ApiProperty({ type: Number, description: 'New order for the record' }) | ||
@IsNotEmpty() // It should have a value | ||
@IsNumber() // Must be a number | ||
readonly order: number; | ||
@ApiProperty({ type: Number, description: 'New order for the record' }) | ||
@IsNotEmpty() // It should have a value | ||
@IsNumber() // Must be a number | ||
readonly order: number; | ||
} | ||
|
||
/** | ||
* DTO for the entire reorder request containing multiple items. | ||
*/ | ||
export class ReorderRequestDTO extends TenantOrganizationBaseDTO implements IReorderRequestDTO { | ||
|
||
@ApiProperty({ type: () => [ReorderDTO], description: 'List of reordering instructions' }) | ||
@IsArray() // Should be an array | ||
@ArrayMinSize(1) // Requires at least one item in the array | ||
@ValidateNested({ each: true }) // Validate each item in the array | ||
@Type(() => ReorderDTO) // Transform to ReorderDTO | ||
reorder: ReorderDTO[]; | ||
@ApiProperty({ type: () => [ReorderDTO], description: 'List of reordering instructions' }) | ||
@IsArray() // Should be an array | ||
@ArrayMinSize(1) // Requires at least one item in the array | ||
@ValidateNested({ each: true }) // Validate each item in the array | ||
@Type(() => ReorderDTO) // Transform to ReorderDTO | ||
reorder: ReorderDTO[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters