import { Field, Int, InputType, ArgsType } from 'type-graphql'; import { Min, Max } from 'class-validator'; import { DateTabType, RangeType } from '@seed/interfaces/components'; import { DateRangeComponent } from '@seed/interfaces/components.dates'; @InputType() export class GetArgs { @Field(() => Int) @Min(1) @Max(100) limit: number; @Field(() => Int) @Min(0) skip: number; @Field({ nullable: true }) sort?: string; } @ArgsType() export class GetManyArgs { @Field(() => [String], { nullable: true }) _ids?: string[]; @Field(() => String, { nullable: true }) search?: string; @Field(() => Date, { nullable: true }) afterCreatedAt?: Date; @Field(() => Date, { nullable: true }) afterUpdatedAt?: Date; @Field(() => GetArgs, { nullable: true }) pagination?: GetArgs; } @ArgsType() export class GetManyArgsWithDateRange extends GetManyArgs { @Field({ nullable: true }) startDate?: Date; @Field({ nullable: true }) endDate?: Date; @Field(() => RangeType, { nullable: true }) rangeType?: RangeType; @Field(() => DateTabType, { nullable: true }) dateTabType?: DateTabType; @Field(() => DateRangeComponent, { nullable: true }) dateRange?: DateRangeComponent; }