-
Notifications
You must be signed in to change notification settings - Fork 13
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 #128 from Sourav-Tekdi/search_tenant
PS-3252: Introduce Status field on program management
- Loading branch information
Showing
8 changed files
with
293 additions
and
127 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
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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; | ||
import { | ||
ArrayNotEmpty, | ||
IsArray, | ||
IsIn, | ||
IsNotEmpty, | ||
IsNumber, | ||
IsObject, | ||
IsOptional, | ||
IsString, | ||
IsUUID, | ||
Max, | ||
Min, | ||
} from "class-validator"; | ||
import { Expose } from "class-transformer"; | ||
|
||
export class TenantFilters { | ||
@ApiPropertyOptional({ type: () => String, description: 'Tenant Id must be a (UUID)' }) | ||
@IsString() | ||
@IsUUID() | ||
@IsOptional() | ||
tenantId?: string; | ||
|
||
@ApiPropertyOptional({ type: () => String }) | ||
@IsString() | ||
@IsOptional() | ||
name?: string; | ||
|
||
@ApiPropertyOptional({ type: () => String }) | ||
@IsOptional() | ||
@IsString() | ||
domain?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: [String], | ||
description: "Status of the tenant", | ||
enum: ['published', 'draft', 'archived'], | ||
isArray: true, | ||
default: ['published'], | ||
}) | ||
@IsArray() | ||
@IsOptional() | ||
@ArrayNotEmpty() // Ensures the array is not empty (if provided) | ||
@IsIn(['published', 'draft', 'archived'], { each: true }) // Validates each array element | ||
@IsNotEmpty({ each: true }) // Ensures no empty strings in the array | ||
@Expose() | ||
status?: ('published' | 'draft' | 'archived')[]; | ||
|
||
@ApiPropertyOptional({ type: () => String, description: 'The ID of the creator (UUID)' }) | ||
@IsString() | ||
@IsUUID() | ||
@IsOptional() | ||
createdBy?: string; | ||
|
||
@ApiPropertyOptional({ type: () => String, description: 'The ID of the updater (UUID)' }) | ||
@IsString() | ||
@IsUUID() | ||
@IsOptional() | ||
updatedBy?: string; | ||
|
||
@ApiPropertyOptional({ type: () => String }) | ||
@IsString() | ||
@IsOptional() | ||
programHead?: string; | ||
} | ||
|
||
export class TenantSearchDTO { | ||
@ApiProperty({ | ||
type: Number, | ||
description: "Limit", | ||
minimum: 1, | ||
maximum: 200, | ||
default: 10, | ||
}) | ||
@IsNumber() | ||
@Min(1) | ||
@Max(200) | ||
limit: number; | ||
|
||
@ApiProperty({ | ||
type: Number, | ||
description: "Offset", | ||
minimum: 0, | ||
maximum: 200, | ||
default: 0, | ||
}) | ||
@IsNumber() | ||
@Min(0) | ||
@Max(200) | ||
offset: number; | ||
|
||
@ApiPropertyOptional({ type: () => TenantFilters }) | ||
@IsOptional() | ||
@IsObject() | ||
@IsNotEmpty({ each: true }) | ||
filters?: TenantFilters; | ||
} |
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
Oops, something went wrong.