Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into merge-upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
metmirr committed Jun 4, 2021
2 parents ef2d476 + b2bcabb commit 56b12d8
Show file tree
Hide file tree
Showing 60 changed files with 5,263 additions and 203 deletions.
5 changes: 2 additions & 3 deletions examples/01-simple-model/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,10 @@ export interface BaseModelUUID extends BaseGraphQLObject {
}

export interface PageInfo {
limit: Float
offset: Float
totalCount: Float
hasNextPage: Boolean
hasPreviousPage: Boolean
startCursor?: String | null
endCursor?: String | null
}

export interface StandardDeleteResponse {
Expand Down
5 changes: 2 additions & 3 deletions examples/01-simple-model/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ type Mutation {
}

type PageInfo {
limit: Float!
offset: Float!
totalCount: Float!
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}

type Query {
Expand Down
29 changes: 26 additions & 3 deletions examples/02-complex-example/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ export interface BaseWhereInput {
deletedById_eq?: String | null
}

export interface EventObjectInput {
params: Array<EventParamInput>
}

export interface EventParamInput {
type: String
name: String
value: JSONObject
}

export interface UserCreateInput {
booleanField?: Boolean | null
dateField?: DateTime | null
Expand All @@ -153,6 +163,7 @@ export interface UserCreateInput {
bigIntField?: Float | null
jsonField?: JSONObject | null
jsonFieldNoFilter?: JSONObject | null
typedJsonField?: EventObjectInput | null
stringField?: String | null
noFilterField?: String | null
noSortField?: String | null
Expand Down Expand Up @@ -197,6 +208,7 @@ export interface UserUpdateInput {
bigIntField?: Float | null
jsonField?: JSONObject | null
jsonFieldNoFilter?: JSONObject | null
typedJsonField?: EventObjectInput | null
stringField?: String | null
noFilterField?: String | null
noSortField?: String | null
Expand Down Expand Up @@ -359,6 +371,7 @@ export interface UserWhereInput {
varcharField_startsWith?: String | null
varcharField_endsWith?: String | null
varcharField_in?: String[] | String | null
geometryField_json?: JSONObject | null
intField_eq?: Int | null
intField_gt?: Int | null
intField_gte?: Int | null
Expand Down Expand Up @@ -469,12 +482,21 @@ export interface BaseModelUUID extends BaseGraphQLObject {
version: Int
}

export interface EventObject {
params: Array<EventParam>
}

export interface EventParam {
type: String
name: String
value: JSONObject
}

export interface PageInfo {
limit: Float
offset: Float
totalCount: Float
hasNextPage: Boolean
hasPreviousPage: Boolean
startCursor?: String | null
endCursor?: String | null
}

export interface StandardDeleteResponse {
Expand Down Expand Up @@ -504,6 +526,7 @@ export interface User extends BaseGraphQLObject {
bigIntField?: Int | null
jsonField?: JSONObject | null
jsonFieldNoFilter?: JSONObject | null
typedJsonField?: EventObject | null
stringField?: String | null
noFilterField?: String | null
noSortField?: String | null
Expand Down
13 changes: 13 additions & 0 deletions examples/02-complex-example/generated/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ import { BaseWhereInput, JsonObject, PaginationArgs, DateOnlyString, DateTimeStr

import { StringEnum } from "../src/modules/user/user.model";

// @ts-ignore
import { EventParam } from "../src/modules/user/user.model";
// @ts-ignore
import { EventObject } from "../src/modules/user/user.model";
// @ts-ignore
import { User } from "../src/modules/user/user.model";

Expand Down Expand Up @@ -532,6 +536,9 @@ export class UserWhereInput {
@TypeGraphQLField(() => [String], { nullable: true })
varcharField_in?: string[];

@TypeGraphQLField(() => GraphQLJSONObject, { nullable: true })
geometryField_json?: JsonObject;

@TypeGraphQLField(() => Int, { nullable: true })
intField_eq?: number;

Expand Down Expand Up @@ -784,6 +791,9 @@ export class UserCreateInput {
@TypeGraphQLField(() => GraphQLJSONObject, { nullable: true })
jsonFieldNoFilter?: JsonObject;

@TypeGraphQLField(() => EventObject, { nullable: true })
typedJsonField?: EventObject;

@TypeGraphQLField({ nullable: true })
stringField?: string;

Expand Down Expand Up @@ -910,6 +920,9 @@ export class UserUpdateInput {
@TypeGraphQLField(() => GraphQLJSONObject, { nullable: true })
jsonFieldNoFilter?: JsonObject;

@TypeGraphQLField(() => EventObject, { nullable: true })
typedJsonField?: EventObject;

@TypeGraphQLField({ nullable: true })
stringField?: string;

Expand Down
29 changes: 26 additions & 3 deletions examples/02-complex-example/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@ interface DeleteResponse {
id: ID!
}

type EventObject {
params: [EventParam!]!
}

input EventObjectInput {
params: [EventParamInput!]!
}

type EventParam {
type: String!
name: String!
value: JSONObject!
}

input EventParamInput {
type: String!
name: String!
value: JSONObject!
}

"""
The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
"""
Expand All @@ -83,11 +103,10 @@ type Mutation {
}

type PageInfo {
limit: Float!
offset: Float!
totalCount: Float!
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}

type Query {
Expand Down Expand Up @@ -127,6 +146,7 @@ type User implements BaseGraphQLObject {
bigIntField: Int
jsonField: JSONObject
jsonFieldNoFilter: JSONObject
typedJsonField: EventObject

"""This is a string field"""
stringField: String
Expand Down Expand Up @@ -172,6 +192,7 @@ input UserCreateInput {
bigIntField: Float
jsonField: JSONObject
jsonFieldNoFilter: JSONObject
typedJsonField: EventObjectInput
stringField: String
noFilterField: String
noSortField: String
Expand Down Expand Up @@ -287,6 +308,7 @@ input UserUpdateInput {
bigIntField: Float
jsonField: JSONObject
jsonFieldNoFilter: JSONObject
typedJsonField: EventObjectInput
stringField: String
noFilterField: String
noSortField: String
Expand Down Expand Up @@ -449,6 +471,7 @@ input UserWhereInput {
varcharField_startsWith: String
varcharField_endsWith: String
varcharField_in: [String!]
geometryField_json: JSONObject
intField_eq: Int
intField_gt: Int
intField_gte: Int
Expand Down
29 changes: 28 additions & 1 deletion examples/02-complex-example/src/modules/user/user.model.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { GraphQLJSONObject } = require('graphql-type-json');
import { Field, InputType } from 'type-graphql';
import { Column, Unique } from 'typeorm';
import {
BaseModel,
Expand All @@ -16,6 +19,7 @@ import {
JsonObject,
Model,
NumericField,
ObjectType,
StringField,
FloatField
} from '../../../../../src';
Expand All @@ -27,6 +31,26 @@ export enum StringEnum {
BAR = 'BAR'
}

@InputType('EventParamInput')
@ObjectType()
export class EventParam {
@Field()
type!: string;

@Field()
name?: string;

@Field(() => GraphQLJSONObject)
value!: JsonObject;
}

@InputType('EventObjectInput')
@ObjectType()
export class EventObject {
@Field(() => [EventParam])
params!: EventParam[];
}

@Model()
@Unique(['stringField', 'enumField'])
export class User extends BaseModel {
Expand Down Expand Up @@ -81,10 +105,13 @@ export class User extends BaseModel {
@JSONField({ filter: false, nullable: true })
jsonFieldNoFilter?: JsonObject;

@JSONField({ filter: false, nullable: true, gqlFieldType: EventObject })
typedJsonField?: EventObject;

@StringField({
maxLength: 50,
minLength: 2,
nullable: false,
nullable: true,
description: 'This is a string field'
})
stringField: string;
Expand Down
12 changes: 12 additions & 0 deletions examples/02-complex-example/tools/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ async function seedDatabase() {
emailField,
stringField,
jsonField,
typedJsonField: {
params: [
{
name: 'Foo',
type: 'Bar',
value: {
one: 1,
two: 'TWO'
}
}
]
},
dateField,
dateOnlyField,
dateTimeField,
Expand Down
5 changes: 2 additions & 3 deletions examples/03-one-to-many-relationship/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,10 @@ export interface BaseModelUUID extends BaseGraphQLObject {
}

export interface PageInfo {
limit: Float
offset: Float
totalCount: Float
hasNextPage: Boolean
hasPreviousPage: Boolean
startCursor?: String | null
endCursor?: String | null
}

export interface Post extends BaseGraphQLObject {
Expand Down
5 changes: 2 additions & 3 deletions examples/03-one-to-many-relationship/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@ type Mutation {
}

type PageInfo {
limit: Float!
offset: Float!
totalCount: Float!
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}

type Post implements BaseGraphQLObject {
Expand Down
5 changes: 2 additions & 3 deletions examples/04-many-to-many-relationship/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,10 @@ export interface BaseModelUUID extends BaseGraphQLObject {
}

export interface PageInfo {
limit: Float
offset: Float
totalCount: Float
hasNextPage: Boolean
hasPreviousPage: Boolean
startCursor?: String | null
endCursor?: String | null
}

export interface Post extends BaseGraphQLObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,10 @@ type Mutation {
}

type PageInfo {
limit: Float!
offset: Float!
totalCount: Float!
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}

type Post implements BaseGraphQLObject {
Expand Down
5 changes: 2 additions & 3 deletions examples/05-migrations/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,10 @@ export interface BaseModelUUID extends BaseGraphQLObject {
}

export interface PageInfo {
limit: Float
offset: Float
totalCount: Float
hasNextPage: Boolean
hasPreviousPage: Boolean
startCursor?: String | null
endCursor?: String | null
}

export interface StandardDeleteResponse {
Expand Down
5 changes: 2 additions & 3 deletions examples/05-migrations/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ interface DeleteResponse {
}

type PageInfo {
limit: Float!
offset: Float!
totalCount: Float!
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}

type Query {
Expand Down
5 changes: 2 additions & 3 deletions examples/06-base-service/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,10 @@ export interface BaseModelUUID extends BaseGraphQLObject {
}

export interface PageInfo {
limit: Float
offset: Float
totalCount: Float
hasNextPage: Boolean
hasPreviousPage: Boolean
startCursor?: String | null
endCursor?: String | null
}

export interface StandardDeleteResponse {
Expand Down

0 comments on commit 56b12d8

Please sign in to comment.