Skip to content

Commit

Permalink
fix(one-to-many): makes one to manys required (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
goldcaddy77 authored Jan 16, 2022
1 parent ea7d1a1 commit 5ff3720
Show file tree
Hide file tree
Showing 21 changed files with 143 additions and 418 deletions.
2 changes: 1 addition & 1 deletion examples/03-one-to-many-relationship/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export interface User {
version: Int
ownerId: ID_Output
firstName: String
posts?: Array<Post> | null
posts: Array<Post>
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ type User {
version: Int!
ownerId: ID!
firstName: String!
posts: [Post!]
posts: [Post!]!
}

input UserCreateInput {
Expand Down
12 changes: 6 additions & 6 deletions examples/04-many-to-many-relationship/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export interface Author {
version: Int
ownerId: ID_Output
firstName: String
posts?: Array<Post> | null
posts: Array<Post>
}

export interface PageInfo {
Expand All @@ -434,7 +434,7 @@ export interface Post {
version: Int
ownerId: ID_Output
name: String
authors?: Array<Author> | null
authors: Array<Author>
posts: Array<Post>
}

Expand All @@ -449,7 +449,7 @@ export interface Role {
version: Int
ownerId: ID_Output
name: String
userRoles?: Array<UserRole> | null
userRoles: Array<UserRole>
}

export interface StandardDeleteResponse {
Expand All @@ -467,7 +467,7 @@ export interface User {
version: Int
ownerId: ID_Output
firstName: String
userRoles?: Array<UserRole> | null
userRoles: Array<UserRole>
}

export interface UserRole {
Expand All @@ -480,9 +480,9 @@ export interface UserRole {
deletedById?: ID_Output | null
version: Int
ownerId: ID_Output
user?: User | null
user: User
userId: ID_Output
role?: Role | null
role: Role
roleId: ID_Output
otherMetadata?: String | null
}
Expand Down
12 changes: 6 additions & 6 deletions examples/04-many-to-many-relationship/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Author {
version: Int!
ownerId: ID!
firstName: String!
posts: [Post!]
posts: [Post!]!
}

input AuthorCreateInput {
Expand Down Expand Up @@ -122,7 +122,7 @@ type Post {
version: Int!
ownerId: ID!
name: String!
authors: [Author!]
authors: [Author!]!
posts: [Post!]!
}

Expand Down Expand Up @@ -218,7 +218,7 @@ type Role {
version: Int!
ownerId: ID!
name: String!
userRoles: [UserRole!]
userRoles: [UserRole!]!
}

input RoleCreateInput {
Expand Down Expand Up @@ -287,7 +287,7 @@ type User {
version: Int!
ownerId: ID!
firstName: String!
userRoles: [UserRole!]
userRoles: [UserRole!]!
}

input UserCreateInput {
Expand Down Expand Up @@ -327,9 +327,9 @@ type UserRole {
deletedById: ID
version: Int!
ownerId: ID!
user: User
user: User!
userId: ID!
role: Role
role: Role!
roleId: ID!
otherMetadata: String
}
Expand Down
32 changes: 16 additions & 16 deletions examples/07-feature-flags/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -914,10 +914,10 @@ export interface Environment {
projKey: String
project?: Project | null
projectId?: ID_Output | null
segments?: Array<Segment> | null
featureFlagUsers?: Array<FeatureFlagUser> | null
featureFlagSegments?: Array<FeatureFlagSegment> | null
userSegments?: Array<UserSegment> | null
segments: Array<Segment>
featureFlagUsers: Array<FeatureFlagUser>
featureFlagSegments: Array<FeatureFlagSegment>
userSegments: Array<UserSegment>
}

export interface FeatureFlag {
Expand All @@ -935,8 +935,8 @@ export interface FeatureFlag {
projKey: String
project?: Project | null
projectId?: ID_Output | null
featureFlagUsers?: Array<FeatureFlagUser> | null
featureFlagSegments?: Array<FeatureFlagSegment> | null
featureFlagUsers: Array<FeatureFlagUser>
featureFlagSegments: Array<FeatureFlagSegment>
}

export interface FeatureFlagSegment {
Expand Down Expand Up @@ -1006,12 +1006,12 @@ export interface Project {
ownerId: ID_Output
name: String
key: String
environments?: Array<Environment> | null
segments?: Array<Segment> | null
featureFlags?: Array<FeatureFlag> | null
featureFlagUsers?: Array<FeatureFlagUser> | null
featureFlagSegments?: Array<FeatureFlagSegment> | null
userSegments?: Array<UserSegment> | null
environments: Array<Environment>
segments: Array<Segment>
featureFlags: Array<FeatureFlag>
featureFlagUsers: Array<FeatureFlagUser>
featureFlagSegments: Array<FeatureFlagSegment>
userSegments: Array<UserSegment>
}

export interface Segment {
Expand All @@ -1033,8 +1033,8 @@ export interface Segment {
envKey: String
environment?: Environment | null
environmentId?: ID_Output | null
featureFlagSegments?: Array<FeatureFlagSegment> | null
userSegments?: Array<UserSegment> | null
featureFlagSegments: Array<FeatureFlagSegment>
userSegments: Array<UserSegment>
}

export interface StandardDeleteResponse {
Expand All @@ -1052,8 +1052,8 @@ export interface User {
version: Int
ownerId: ID_Output
key: String
featureFlagUsers?: Array<FeatureFlagUser> | null
userSegments?: Array<UserSegment> | null
featureFlagUsers: Array<FeatureFlagUser>
userSegments: Array<UserSegment>
}

export interface UserSegment {
Expand Down
32 changes: 16 additions & 16 deletions examples/07-feature-flags/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ type Environment {
projKey: String!
project: Project
projectId: ID
segments: [Segment!]
featureFlagUsers: [FeatureFlagUser!]
featureFlagSegments: [FeatureFlagSegment!]
userSegments: [UserSegment!]
segments: [Segment!]!
featureFlagUsers: [FeatureFlagUser!]!
featureFlagSegments: [FeatureFlagSegment!]!
userSegments: [UserSegment!]!
}

input EnvironmentCreateInput {
Expand Down Expand Up @@ -141,8 +141,8 @@ type FeatureFlag {
projKey: String!
project: Project
projectId: ID
featureFlagUsers: [FeatureFlagUser!]
featureFlagSegments: [FeatureFlagSegment!]
featureFlagUsers: [FeatureFlagUser!]!
featureFlagSegments: [FeatureFlagSegment!]!
}

input FeatureFlagCreateInput {
Expand Down Expand Up @@ -590,12 +590,12 @@ type Project {
ownerId: ID!
name: String!
key: String!
environments: [Environment!]
segments: [Segment!]
featureFlags: [FeatureFlag!]
featureFlagUsers: [FeatureFlagUser!]
featureFlagSegments: [FeatureFlagSegment!]
userSegments: [UserSegment!]
environments: [Environment!]!
segments: [Segment!]!
featureFlags: [FeatureFlag!]!
featureFlagUsers: [FeatureFlagUser!]!
featureFlagSegments: [FeatureFlagSegment!]!
userSegments: [UserSegment!]!
}

input ProjectCreateInput {
Expand Down Expand Up @@ -720,8 +720,8 @@ type Segment {
envKey: String!
environment: Environment
environmentId: ID
featureFlagSegments: [FeatureFlagSegment!]
userSegments: [UserSegment!]
featureFlagSegments: [FeatureFlagSegment!]!
userSegments: [UserSegment!]!
}

input SegmentCreateInput {
Expand Down Expand Up @@ -861,8 +861,8 @@ type User {
version: Int!
ownerId: ID!
key: String!
featureFlagUsers: [FeatureFlagUser!]
userSegments: [UserSegment!]
featureFlagUsers: [FeatureFlagUser!]!
userSegments: [UserSegment!]!
}

input UserCreateInput {
Expand Down
2 changes: 1 addition & 1 deletion examples/08-performance/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export interface User {
version: Int
ownerId: ID_Output
firstName: String
posts?: Array<Post> | null
posts: Array<Post>
}

/*
Expand Down
2 changes: 1 addition & 1 deletion examples/08-performance/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ type User {
version: Int!
ownerId: ID!
firstName: String!
posts: [Post!]
posts: [Post!]!
}

input UserCreateInput {
Expand Down
58 changes: 0 additions & 58 deletions examples/09-production/generated/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,61 +21,3 @@ const { GraphQLJSONObject } = require('graphql-type-json');
// @ts-ignore

import { BaseWhereInput, JsonObject, PaginationArgs, DateOnlyString, DateTimeString, IDType } from '../../../src';

// @ts-ignore

import { User } from "../dist/examples/09-production/src/modules/user/user.model";

export enum UserOrderByEnum {
id_ASC = "id_ASC",
id_DESC = "id_DESC"
}

registerEnumType(UserOrderByEnum, {
name: "UserOrderByInput"
});

@TypeGraphQLInputType()
export class UserWhereInput {
@TypeGraphQLField(() => [ID], { nullable: true })
id_in?: string[];
}

@TypeGraphQLInputType()
export class UserWhereUniqueInput {
@TypeGraphQLField(() => ID)
id?: string;
}

@TypeGraphQLInputType()
export class UserCreateInput {
@TypeGraphQLField()
firstName!: string;
}

@TypeGraphQLInputType()
export class UserUpdateInput {
@TypeGraphQLField({ nullable: true })
firstName?: string;
}

@ArgsType()
export class UserWhereArgs extends PaginationArgs {
@TypeGraphQLField(() => UserWhereInput, { nullable: true })
where?: UserWhereInput;

@TypeGraphQLField(() => UserOrderByEnum, { nullable: true })
orderBy?: UserOrderByEnum;
}

@ArgsType()
export class UserCreateManyArgs {
@TypeGraphQLField(() => [UserCreateInput])
data!: UserCreateInput[];
}

@ArgsType()
export class UserUpdateArgs {
@TypeGraphQLField() data!: UserUpdateInput;
@TypeGraphQLField() where!: UserWhereUniqueInput;
}
20 changes: 12 additions & 8 deletions examples/10-subscriptions/generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ export type UserOrderByInput = 'firstName_ASC' |
'firstName_DESC' |
'lastName_ASC' |
'lastName_DESC' |
'id_ASC' |
'id_DESC' |
'createdAt_ASC' |
'createdAt_DESC' |
'createdById_ASC' |
Expand All @@ -63,7 +61,11 @@ export type UserOrderByInput = 'firstName_ASC' |
'deletedById_ASC' |
'deletedById_DESC' |
'version_ASC' |
'version_DESC'
'version_DESC' |
'ownerId_ASC' |
'ownerId_DESC' |
'id_ASC' |
'id_DESC'

export interface UserCreateInput {
firstName: String
Expand All @@ -86,8 +88,6 @@ export interface UserWhereInput {
lastName_startsWith?: String | null
lastName_endsWith?: String | null
lastName_in?: String[] | String | null
id_eq?: ID_Input | null
id_in?: ID_Output[] | ID_Output | null
createdAt_eq?: DateTime | null
createdAt_lt?: DateTime | null
createdAt_lte?: DateTime | null
Expand Down Expand Up @@ -116,6 +116,9 @@ export interface UserWhereInput {
version_lt?: Int | null
version_lte?: Int | null
version_in?: Int[] | Int | null
ownerId_eq?: ID_Input | null
ownerId_in?: ID_Output[] | ID_Output | null
id_in?: ID_Output[] | ID_Output | null
}

export interface UserWhereUniqueInput {
Expand All @@ -140,12 +143,13 @@ export interface StandardDeleteResponse {
export interface User {
id: ID_Output
createdAt: DateTime
createdById: String
createdById: ID_Output
updatedAt?: DateTime | null
updatedById?: String | null
updatedById?: ID_Output | null
deletedAt?: DateTime | null
deletedById?: String | null
deletedById?: ID_Output | null
version: Int
ownerId: ID_Output
firstName: String
lastName: String
}
Expand Down
Loading

0 comments on commit 5ff3720

Please sign in to comment.