* Controller Layer updates. * adding email filtering and pagination to team memberships endpoint.. * Minor enhancements. * Improve addressed. * refactor: update team memberships input to handle comma-separated emails - Replace array format with comma-separated string handling - Add proper email validation with BadRequestException - Remove ArrayMaxSize constraint for better flexibility - Update API documentation and examples - Align with codebase patterns from get-managed-users.input.ts * Morgan suggestions addressed. * More improvements......
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { Transform } from "class-transformer";
|
|
import { IsNumber, IsOptional, Max, Min, Validate } from "class-validator";
|
|
|
|
import { IsEmailStringOrArray } from "../validators/isEmailStringOrArray";
|
|
|
|
export class GetUsersInput {
|
|
@ApiProperty({ required: false, description: "The number of items to return", example: 10 })
|
|
@Transform(({ value }: { value: string }) => value && parseInt(value))
|
|
@IsNumber()
|
|
@Min(1)
|
|
@Max(1000)
|
|
@IsOptional()
|
|
take?: number;
|
|
|
|
@ApiProperty({ required: false, description: "The number of items to skip", example: 0 })
|
|
@Transform(({ value }: { value: string }) => value && parseInt(value))
|
|
@IsNumber()
|
|
@Min(0)
|
|
@IsOptional()
|
|
skip?: number;
|
|
|
|
@IsOptional()
|
|
@Validate(IsEmailStringOrArray)
|
|
@Transform(({ value }: { value: string | string[] }) => {
|
|
return typeof value === "string" ? [value] : value;
|
|
})
|
|
@ApiPropertyOptional({
|
|
type: [String],
|
|
description: "The email address or an array of email addresses to filter by",
|
|
example: ["user1@example.com", "user2@example.com"],
|
|
})
|
|
emails?: string[];
|
|
}
|