@nestjs/graphql#InputType TypeScript Examples

The following examples show how to use @nestjs/graphql#InputType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: update-post-input.dto.ts    From nest-casl with MIT License 7 votes vote down vote up
@InputType()
export class UpdatePostInput {
  @Field()
  id: string;

  @Field()
  userId: string;

  @Field({ nullable: true })
  title?: string;
}
Example #2
Source File: tag.input.ts    From whispr with MIT License 6 votes vote down vote up
@InputType({ description: 'New Tag' })
export class TagInputType {
  @Field(() => String, { nullable: true })
  @IsString()
  @IsOptional()
  _id?: string;

  @Field({ nullable: true })
  @IsString()
  @IsOptional()
  title?: string;

  @Field(() => String, { nullable: true })
  @IsString()
  @IsOptional()
  status?: TagStatuses;

  @Field(() => TagGroupInputType, { nullable: true })
  @IsString()
  @IsOptional()
  tagGroup?: TagGroupInputType;
}
Example #3
Source File: entity-list-relation-filter.template.ts    From amplication with Apache License 2.0 6 votes vote down vote up
@InputType()
class ID {
  @ApiProperty({
    required: false,
    type: () => WHERE_INPUT,
  })
  @ValidateNested()
  @Type(() => WHERE_INPUT)
  @IsOptional()
  @Field(() => WHERE_INPUT, {
    nullable: true,
  })
  every?: WHERE_INPUT;

  @ApiProperty({
    required: false,
    type: () => WHERE_INPUT,
  })
  @ValidateNested()
  @Type(() => WHERE_INPUT)
  @IsOptional()
  @Field(() => WHERE_INPUT, {
    nullable: true,
  })
  some?: WHERE_INPUT;

  @ApiProperty({
    required: false,
    type: () => WHERE_INPUT,
  })
  @ValidateNested()
  @Type(() => WHERE_INPUT)
  @IsOptional()
  @Field(() => WHERE_INPUT, {
    nullable: true,
  })
  none?: WHERE_INPUT;
}
Example #4
Source File: create-notification.input.ts    From aws-nestjs-starter with The Unlicense 6 votes vote down vote up
@InputType()
@InterfaceType('BaseNotification')
export class CreateNotificationInput {
  @IsNotEmpty()
  @IsString()
  @Field()
  targetId: string;

  @IsNotEmpty()
  @IsString()
  @Field()
  userId: string;

  @IsNotEmpty()
  @IsString()
  @Field()
  content: string;
}
Example #5
Source File: auth-token.input.ts    From relate with GNU General Public License v3.0 6 votes vote down vote up
@InputType()
export class AuthTokenInput implements IAuthToken {
    @Field(() => String)
    @Equals('basic')
    scheme: 'basic';

    @Field(() => String)
    principal: string;

    @Field(() => String)
    credentials: string;

    @Field(() => String, {nullable: true})
    realm?: string;

    @Field(() => GraphQLJSONObject, {nullable: true})
    parameters?: Record<string, any>;
}
Example #6
Source File: button.input.ts    From api with GNU Affero General Public License v3.0 6 votes vote down vote up
@InputType()
export class ButtonInput {
  @Field(() => ID, { nullable: true })
  readonly id?: string

  @Field({ nullable: true })
  readonly url?: string

  @Field({ nullable: true })
  readonly action?: string

  @Field({ nullable: true })
  readonly text?: string

  @Field({ nullable: true })
  readonly bgColor?: string

  @Field({ nullable: true })
  readonly activeColor?: string

  @Field({ nullable: true })
  readonly color?: string
}