type-graphql#InputType TypeScript Examples

The following examples show how to use type-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: base-filter.filter.ts    From Cromwell with MIT License 6 votes vote down vote up
@InputType()
export class PropertySearch {
    @Field(() => String, { nullable: true })
    key?: string;

    @Field(() => PrimitiveValueScalar, { nullable: true })
    value?: string | number | boolean | null;

    @Field(() => Boolean, { nullable: true })
    exact?: boolean;

    @Field(() => Boolean, { nullable: true })
    inMeta?: boolean;
}
Example #2
Source File: BuildFlashFirmwareInput.ts    From ExpressLRS-Configurator with GNU General Public License v3.0 6 votes vote down vote up
@InputType('BuildFlashFirmwareInput')
export default class BuildFlashFirmwareInput {
  @Field(() => BuildJobType)
  type: BuildJobType;

  @Field({ nullable: true })
  serialDevice?: string;

  @Field(() => FirmwareVersionDataInput)
  firmware: FirmwareVersionDataInput;

  @Field()
  target: string;

  @Field(() => UserDefinesMode)
  userDefinesMode: UserDefinesMode;

  @Field(() => [UserDefineInput])
  userDefines: UserDefineInput[];

  @Field()
  userDefinesTxt: string;

  constructor() {
    this.type = BuildJobType.Build;
    this.firmware = new FirmwareVersionDataInput();
    this.target = 'DIY_2400_TX_ESP32_SX1280_E28_via_UART';
    this.userDefinesMode = UserDefinesMode.UserInterface;
    this.userDefines = [];
    this.userDefinesTxt = '';
  }
}
Example #3
Source File: DepartmentInput.ts    From graphql-ts-client with MIT License 6 votes vote down vote up
@InputType()
export class DepartmentInput implements TDepartment {

    @Field(() => String)
    readonly id: string;

    @Field(() => String)
    readonly name: string;
}
Example #4
Source File: UsernamePasswordInput.ts    From lireddit with MIT License 6 votes vote down vote up
@InputType()
export class UsernamePasswordInput {
  @Field()
  email: string;
  @Field()
  username: string;
  @Field()
  password: string;
}
Example #5
Source File: ChatMessageCreate.input.ts    From bouncecode-cms with GNU General Public License v3.0 6 votes vote down vote up
@InputType()
export class ChatMessageCreateInput {
  @Field()
  id: string;

  @Field()
  title: string;

  @Field()
  description: string;

  @Field({nullable: true})
  category?: ChatCategoryUniqueWhereInput;

  @Field(() => [UserUniqueWhereInput])
  attendees: UserUniqueWhereInput[];

  @Field(() => GraphQLJSON)
  payload: any;
}
Example #6
Source File: userInput.ts    From Wern-Fullstack-Template with MIT License 6 votes vote down vote up
@InputType()
export class UserInput {
  @Field()
  email: string
  @Field()
  username: string
  @Field()
  password: string
}
Example #7
Source File: mutations.ts    From backend with MIT License 6 votes vote down vote up
@InputType()
class CertificateCreationInput implements ICertificateCreationParams {
    @Field()
    endDate: number;
    @Field()
    subjects: string;
    @Field()
    hoursPerWeek: number;
    @Field()
    hoursTotal: number;
    @Field()
    medium: string;
    @Field()
    activities: string;
    @Field()
    ongoingLessons: boolean;
    @Field()
    @IsIn([CertificateState.manual, CertificateState.awaitingApproval])
    state: CertificateState.manual | CertificateState.awaitingApproval;
}
Example #8
Source File: author.validator.ts    From mikro-orm-graphql-example with MIT License 6 votes vote down vote up
@InputType()
class AuthorValidator {
  @Field()
  @IsString()
  public name: string;

  @Field()
  @IsEmail()
  public email: string;

  @Field({ nullable: true })
  @IsDate()
  @IsOptional()
  public born?: Date;
}
Example #9
Source File: new-request.input.ts    From opensaas with MIT License 6 votes vote down vote up
@InputType()
export class NewRequestInput {
  @Field()
  url!: string;

  @Field()
  statusCode!: number;

  @Field()
  userAgent!: string;

  @Field()
  ip!: string;
}
Example #10
Source File: Inputs.ts    From liferay-grow with MIT License 6 votes vote down vote up
@InputType()
export class GrowMapBaseInput {
  @Field(() => [KnowledgeGapsDetailBaseInput], {
    defaultValue: [],
  })
  knowledgeGapsDetails: KnowledgeGapsDetailBaseInput[];

  @Field(() => [KnowledgeSkillDetailBaseInput], { defaultValue: [] })
  knowledgeSkillDetails: KnowledgeSkillDetailBaseInput[];

  @Field()
  userDetails: UserDetailBaseInput;
}
Example #11
Source File: info.ts    From Koa-GraphQL-Template with MIT License 6 votes vote down vote up
@InputType()
class InfoInput {
    @Field(() => [String], { description: '爱好' })
    public hobby!: string[];

    @Field({ description: '身高' })
    public height!: string;

    @Field({ description: '体重' })
    public weight!: number;
}
Example #12
Source File: base-filter.filter.ts    From Cromwell with MIT License 5 votes vote down vote up
@InputType()
export class BaseFilterInput implements TBaseFilter {
    @Field(() => [PropertySearch], { nullable: true })
    filters?: PropertySearch[];

    @Field(() => [SortByOptions], { nullable: true })
    sorts?: SortByOptions[];
}
Example #13
Source File: post.ts    From lireddit with MIT License 5 votes vote down vote up
@InputType()
class PostInput {
  @Field()
  title: string;
  @Field()
  text: string;
}
Example #14
Source File: ChatCategoryUniqueWhere.input.ts    From bouncecode-cms with GNU General Public License v3.0 5 votes vote down vote up
@InputType()
export class ChatCategoryUniqueWhereInput {
  @Field()
  id: number;
}
Example #15
Source File: mutation.ts    From backend with MIT License 5 votes vote down vote up
@InputType()
class StudentUpdateInput {
    @Field(type => [Subject], { nullable: true })
    subjects?: Subject[];

    @Field(type => [ProjectFieldWithGradeInput], { nullable: true })
    projectFields: ProjectFieldWithGradeInput[];
}
Example #16
Source File: book.validator.ts    From mikro-orm-graphql-example with MIT License 5 votes vote down vote up
@InputType()
class BookValidator {
  @Field()
  @IsString()
  public title: string;
}