From 4ac47796898a338cd9f557ecb3713b92912a9a35 Mon Sep 17 00:00:00 2001 From: roman Date: Sun, 4 Oct 2020 18:33:08 +0400 Subject: [PATCH] fix: Adapted generator to Prisma 2.8 BREAKING CHANGE: Adapted generator to Prisma 2.8 --- README.md | 1 + package.json | 41 ++++++----- .../article/aggregate-article.args.ts | 12 +-- .../article/aggregate-article.output.ts | 10 +-- .../article/article-avg-aggregate.output.ts | 2 +- ...rticle-create-many-without-author.input.ts | 4 +- ...-create-many-without-favorited-by.input.ts | 4 +- .../article-create-many-without-tags.input.ts | 4 +- .../article-create-without-author.input.ts | 6 +- .../article-create-without-comments.input.ts | 4 +- ...ticle-create-without-favorited-by.input.ts | 4 +- .../article-create-without-tags.input.ts | 4 +- .../article/article-create.input.ts | 6 +- .../article/article-max-aggregate.output.ts | 2 +- .../article/article-min-aggregate.output.ts | 2 +- .../article/article-order-by.input.ts | 2 +- .../article/article-scalar-where.input.ts | 22 +++--- .../article/article-sum-aggregate.output.ts | 2 +- ...rticle-update-many-without-author.input.ts | 24 +++--- ...-update-many-without-favorited-by.input.ts | 24 +++--- .../article-update-many-without-tags.input.ts | 24 +++--- ...rticle-update-without-author-data.input.ts | 6 +- ...icle-update-without-comments-data.input.ts | 4 +- ...-update-without-favorited-by-data.input.ts | 4 +- .../article-update-without-tags-data.input.ts | 4 +- .../article/article-update.input.ts | 6 +- src/@generated/article/article-where.input.ts | 31 ++++---- src/@generated/article/article.model.ts | 8 +- .../article/find-first-article.args.ts | 45 ++++++++++++ .../article/find-many-article.args.ts | 2 +- .../comment/aggregate-comment.args.ts | 4 +- .../comment/aggregate-comment.output.ts | 2 +- ...mment-create-many-without-article.input.ts | 4 +- ...omment-create-many-without-author.input.ts | 4 +- .../comment-create-without-author.input.ts | 2 +- .../comment/comment-create.input.ts | 2 +- .../comment/comment-order-by.input.ts | 2 +- .../comment/comment-scalar-where.input.ts | 14 ++-- ...mment-update-many-without-article.input.ts | 24 +++--- ...omment-update-many-without-author.input.ts | 24 +++--- ...omment-update-without-author-data.input.ts | 2 +- .../comment/comment-update.input.ts | 2 +- src/@generated/comment/comment-where.input.ts | 20 ++--- src/@generated/comment/comment.model.ts | 4 +- .../comment/find-first-comment.args.ts | 45 ++++++++++++ .../comment/find-many-comment.args.ts | 2 +- src/@generated/prisma/batch-payload.output.ts | 2 +- .../prisma/date-time-filter.input.ts | 6 +- src/@generated/prisma/float-filter.input.ts | 12 +-- src/@generated/prisma/int-filter.input.ts | 6 +- src/@generated/prisma/query-mode.enum.ts | 8 ++ src/@generated/prisma/string-filter.input.ts | 14 +++- src/@generated/tag/aggregate-tag.args.ts | 4 +- src/@generated/tag/aggregate-tag.output.ts | 2 +- src/@generated/tag/find-first-tag.args.ts | 45 ++++++++++++ src/@generated/tag/find-many-tag.args.ts | 2 +- .../tag-create-many-without-articles.input.ts | 4 +- src/@generated/tag/tag-create.input.ts | 2 +- src/@generated/tag/tag-scalar-where.input.ts | 6 +- .../tag-update-many-without-articles.input.ts | 22 +++--- src/@generated/tag/tag-update.input.ts | 2 +- src/@generated/tag/tag-where.input.ts | 8 +- src/@generated/tag/tag.model.ts | 2 +- src/@generated/user/aggregate-user.args.ts | 12 +-- src/@generated/user/aggregate-user.output.ts | 10 +-- src/@generated/user/find-first-user.args.ts | 45 ++++++++++++ src/@generated/user/find-many-user.args.ts | 2 +- .../user/user-avg-aggregate.input.ts | 4 +- .../user/user-avg-aggregate.output.ts | 4 +- ...te-many-without-favorite-articles.input.ts | 4 +- ...ser-create-many-without-followers.input.ts | 4 +- ...ser-create-many-without-following.input.ts | 4 +- .../user-create-without-articles.input.ts | 8 +- .../user-create-without-comments.input.ts | 8 +- ...-create-without-favorite-articles.input.ts | 8 +- .../user-create-without-followers.input.ts | 8 +- .../user-create-without-following.input.ts | 8 +- src/@generated/user/user-create.input.ts | 10 +-- .../user/user-max-aggregate.input.ts | 4 +- .../user/user-max-aggregate.output.ts | 4 +- .../user/user-min-aggregate.input.ts | 4 +- .../user/user-min-aggregate.output.ts | 4 +- src/@generated/user/user-order-by.input.ts | 8 +- .../user/user-relation-filter.input.ts | 4 +- .../user/user-scalar-where.input.ts | 18 ++--- .../user/user-sum-aggregate.input.ts | 4 +- .../user/user-sum-aggregate.output.ts | 4 +- ...te-many-without-favorite-articles.input.ts | 22 +++--- ...ser-update-many-without-followers.input.ts | 22 +++--- ...ser-update-many-without-following.input.ts | 22 +++--- ...user-update-without-articles-data.input.ts | 8 +- ...user-update-without-comments-data.input.ts | 8 +- ...te-without-favorite-articles-data.input.ts | 8 +- ...ser-update-without-followers-data.input.ts | 8 +- ...ser-update-without-following-data.input.ts | 8 +- src/@generated/user/user-update.input.ts | 10 +-- src/@generated/user/user-where.input.ts | 28 +++---- src/@generated/user/user.model.ts | 18 ++--- src/generate-args.ts | 12 +-- src/generate-input/generate-input.spec.ts | 41 ++++++++--- src/generate-input/generate-input.ts | 73 +++++++------------ .../get-matching-input-type.spec.ts | 54 ++++++++++++++ src/generate-input/get-matching-input-type.ts | 27 +++++++ src/generate-model/generate-model.spec.ts | 17 ++++- src/generate-property.ts | 9 +-- src/generate.spec.ts | 53 ++++++++++++-- src/generate.ts | 3 +- src/mutate-filters.ts | 4 +- src/type-utils.ts | 46 ++++++++---- 109 files changed, 854 insertions(+), 458 deletions(-) create mode 100644 src/@generated/article/find-first-article.args.ts create mode 100644 src/@generated/comment/find-first-comment.args.ts create mode 100644 src/@generated/prisma/query-mode.enum.ts create mode 100644 src/@generated/tag/find-first-tag.args.ts create mode 100644 src/@generated/user/find-first-user.args.ts create mode 100644 src/generate-input/get-matching-input-type.spec.ts create mode 100644 src/generate-input/get-matching-input-type.ts diff --git a/README.md b/README.md index 142d9491..da4e55f6 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ npx prisma generate ## Resources - Todo - https://github.com/unlight/prisma-nestjs-graphql/issues/2 +- https://github.com/prisma/prisma/blob/master/src/packages/client/src/generation/TSClient.ts - https://ts-ast-viewer.com/ - https://github.com/unlight/nestjs-graphql-prisma-realworld-example-app - https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/data-model diff --git a/package.json b/package.json index ffd7b778..8b0d1540 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "prisma:g": "node node_modules/@prisma/cli/build/index.js generate", "prettier:format": "npx prettier src --write", "regen": "rm -rf src/@generated && npm run prisma:g && npm run eslint:fix && npm run prettier:format", - "example": "ts-node-dev src/example/main.ts" + "example": "ts-node-dev src/example/main.ts", + "clean_cache": "rm -rf node_modules/.cache" }, "husky": { "hooks": { @@ -48,40 +49,40 @@ } }, "dependencies": { - "@prisma/generator-helper": "^2.7.1", + "@prisma/generator-helper": "^2.8.0", "get-relative-path": "^1.0.2", "pupa": "^2.0.1", "to-kebab": "^1.0.7", - "ts-morph": "^8.1.0", + "ts-morph": "^8.1.1", "typescript-equals": "^1.0.0" }, "peerDependencies": { - "@prisma/client": ">=2.5" + "@prisma/client": ">=2.8" }, "devDependencies": { "@commitlint/cli": "^11.0.0", "@commitlint/config-conventional": "^11.0.0", "@nestjs/common": "^7.4.4", "@nestjs/core": "^7.4.4", - "@nestjs/graphql": "^7.6.0", + "@nestjs/graphql": "^7.7.0", "@nestjs/platform-express": "^7.4.4", - "@paljs/plugins": "^1.4.0", - "@prisma/cli": "^2.7.1", - "@prisma/client": ">=2.6", + "@paljs/plugins": "^2.2.0", + "@prisma/cli": "^2.8.0", + "@prisma/client": "^2.8.0", "@semantic-release/changelog": "^5.0.1", "@semantic-release/git": "^9.0.0", "@types/mocha": "^8.0.3", - "@types/node": "^14.11.1", - "@typescript-eslint/eslint-plugin": "^4.1.1", - "@typescript-eslint/parser": "^4.1.1", - "apollo-server-express": "^2.17.0", - "c8": "^7.3.0", + "@types/node": "^14.11.2", + "@typescript-eslint/eslint-plugin": "^4.3.0", + "@typescript-eslint/parser": "^4.3.0", + "apollo-server-express": "^2.18.1", + "c8": "^7.3.1", "class-transformer": "^0.3.1", "class-validator": "^0.12.2", - "eslint": "^7.9.0", + "eslint": "^7.10.0", "eslint-import-resolver-node": "^0.3.4", - "eslint-plugin-etc": "0.0.2-beta.45", - "eslint-plugin-import": "^2.22.0", + "eslint-plugin-etc": "0.0.3-beta.48", + "eslint-plugin-import": "^2.22.1", "eslint-plugin-only-warn": "^1.0.2", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-promise": "^4.2.1", @@ -89,8 +90,8 @@ "eslint-plugin-simple-import-sort": "^5.0.3", "eslint-plugin-sonarjs": "^0.5.0", "eslint-plugin-sort-class-members": "^1.8.0", - "eslint-plugin-total-functions": "^3.3.0", - "eslint-plugin-unicorn": "^21.0.0", + "eslint-plugin-total-functions": "^4.4.0", + "eslint-plugin-unicorn": "^22.0.0", "eslint-plugin-wix-editor": "^3.2.0", "find-cache-dir": "^3.3.1", "git-branch-is": "^4.0.0", @@ -105,8 +106,8 @@ "semantic-release": "^17.1.2", "simplytyped": "^3.3.0", "ts-node": "^9.0.0", - "ts-node-dev": "^1.0.0-pre.62", - "typescript": "~4.0.2", + "ts-node-dev": "^1.0.0-pre.63", + "typescript": "~4.0.3", "watchexec-bin": "^1.0.0" } } diff --git a/src/@generated/article/aggregate-article.args.ts b/src/@generated/article/aggregate-article.args.ts index 35a4faa7..f4509840 100644 --- a/src/@generated/article/aggregate-article.args.ts +++ b/src/@generated/article/aggregate-article.args.ts @@ -21,7 +21,7 @@ export class AggregateArticleArgs { nullable: true, description: undefined, }) - orderBy?: Array; + orderBy?: Array | ArticleOrderByInput; @Field(() => ArticleWhereUniqueInput, { nullable: true, @@ -51,29 +51,29 @@ export class AggregateArticleArgs { nullable: true, description: undefined, }) - count?: true | null; + count?: true; @Field(() => ArticleAvgAggregateInput, { nullable: true, description: undefined, }) - avg?: ArticleAvgAggregateInput | null; + avg?: ArticleAvgAggregateInput; @Field(() => ArticleSumAggregateInput, { nullable: true, description: undefined, }) - sum?: ArticleSumAggregateInput | null; + sum?: ArticleSumAggregateInput; @Field(() => ArticleMinAggregateInput, { nullable: true, description: undefined, }) - min?: ArticleMinAggregateInput | null; + min?: ArticleMinAggregateInput; @Field(() => ArticleMaxAggregateInput, { nullable: true, description: undefined, }) - max?: ArticleMaxAggregateInput | null; + max?: ArticleMaxAggregateInput; } diff --git a/src/@generated/article/aggregate-article.output.ts b/src/@generated/article/aggregate-article.output.ts index f0d743c7..ec4c8b22 100644 --- a/src/@generated/article/aggregate-article.output.ts +++ b/src/@generated/article/aggregate-article.output.ts @@ -11,29 +11,29 @@ export class AggregateArticle { nullable: true, description: undefined, }) - count?: number | null; + count?: number; @Field(() => ArticleAvgAggregate, { nullable: true, description: undefined, }) - avg?: ArticleAvgAggregate | null; + avg?: ArticleAvgAggregate; @Field(() => ArticleSumAggregate, { nullable: true, description: undefined, }) - sum?: ArticleSumAggregate | null; + sum?: ArticleSumAggregate; @Field(() => ArticleMinAggregate, { nullable: true, description: undefined, }) - min?: ArticleMinAggregate | null; + min?: ArticleMinAggregate; @Field(() => ArticleMaxAggregate, { nullable: true, description: undefined, }) - max?: ArticleMaxAggregate | null; + max?: ArticleMaxAggregate; } diff --git a/src/@generated/article/article-avg-aggregate.output.ts b/src/@generated/article/article-avg-aggregate.output.ts index d7a4a056..b66ad89b 100644 --- a/src/@generated/article/article-avg-aggregate.output.ts +++ b/src/@generated/article/article-avg-aggregate.output.ts @@ -6,5 +6,5 @@ export class ArticleAvgAggregate { nullable: true, description: undefined, }) - favoritesCount?: number | null; + favoritesCount?: number; } diff --git a/src/@generated/article/article-create-many-without-author.input.ts b/src/@generated/article/article-create-many-without-author.input.ts index 3759c239..babb14c8 100644 --- a/src/@generated/article/article-create-many-without-author.input.ts +++ b/src/@generated/article/article-create-many-without-author.input.ts @@ -9,11 +9,11 @@ export class ArticleCreateManyWithoutAuthorInput { nullable: true, description: undefined, }) - create?: Array; + create?: ArticleCreateWithoutAuthorInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: ArticleWhereUniqueInput | Array; } diff --git a/src/@generated/article/article-create-many-without-favorited-by.input.ts b/src/@generated/article/article-create-many-without-favorited-by.input.ts index 162f6808..c6ac7158 100644 --- a/src/@generated/article/article-create-many-without-favorited-by.input.ts +++ b/src/@generated/article/article-create-many-without-favorited-by.input.ts @@ -9,11 +9,11 @@ export class ArticleCreateManyWithoutFavoritedByInput { nullable: true, description: undefined, }) - create?: Array; + create?: ArticleCreateWithoutFavoritedByInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: ArticleWhereUniqueInput | Array; } diff --git a/src/@generated/article/article-create-many-without-tags.input.ts b/src/@generated/article/article-create-many-without-tags.input.ts index 31a569eb..cd43b801 100644 --- a/src/@generated/article/article-create-many-without-tags.input.ts +++ b/src/@generated/article/article-create-many-without-tags.input.ts @@ -9,11 +9,11 @@ export class ArticleCreateManyWithoutTagsInput { nullable: true, description: undefined, }) - create?: Array; + create?: ArticleCreateWithoutTagsInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: ArticleWhereUniqueInput | Array; } diff --git a/src/@generated/article/article-create-without-author.input.ts b/src/@generated/article/article-create-without-author.input.ts index 666176a8..2af26d91 100644 --- a/src/@generated/article/article-create-without-author.input.ts +++ b/src/@generated/article/article-create-without-author.input.ts @@ -64,17 +64,17 @@ export class ArticleCreateWithoutAuthorInput { nullable: true, description: undefined, }) - tags?: TagCreateManyWithoutArticlesInput | null; + tags?: TagCreateManyWithoutArticlesInput; @Field(() => UserCreateManyWithoutFavoriteArticlesInput, { nullable: true, description: undefined, }) - favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput | null; + favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput; @Field(() => CommentCreateManyWithoutArticleInput, { nullable: true, description: undefined, }) - comments?: CommentCreateManyWithoutArticleInput | null; + comments?: CommentCreateManyWithoutArticleInput; } diff --git a/src/@generated/article/article-create-without-comments.input.ts b/src/@generated/article/article-create-without-comments.input.ts index 6d49b3c8..1cdfc7ff 100644 --- a/src/@generated/article/article-create-without-comments.input.ts +++ b/src/@generated/article/article-create-without-comments.input.ts @@ -64,7 +64,7 @@ export class ArticleCreateWithoutCommentsInput { nullable: true, description: undefined, }) - tags?: TagCreateManyWithoutArticlesInput | null; + tags?: TagCreateManyWithoutArticlesInput; @Field(() => UserCreateOneWithoutArticlesInput, { nullable: true, @@ -76,5 +76,5 @@ export class ArticleCreateWithoutCommentsInput { nullable: true, description: undefined, }) - favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput | null; + favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput; } diff --git a/src/@generated/article/article-create-without-favorited-by.input.ts b/src/@generated/article/article-create-without-favorited-by.input.ts index 8a2774f2..a53f481e 100644 --- a/src/@generated/article/article-create-without-favorited-by.input.ts +++ b/src/@generated/article/article-create-without-favorited-by.input.ts @@ -64,7 +64,7 @@ export class ArticleCreateWithoutFavoritedByInput { nullable: true, description: undefined, }) - tags?: TagCreateManyWithoutArticlesInput | null; + tags?: TagCreateManyWithoutArticlesInput; @Field(() => UserCreateOneWithoutArticlesInput, { nullable: true, @@ -76,5 +76,5 @@ export class ArticleCreateWithoutFavoritedByInput { nullable: true, description: undefined, }) - comments?: CommentCreateManyWithoutArticleInput | null; + comments?: CommentCreateManyWithoutArticleInput; } diff --git a/src/@generated/article/article-create-without-tags.input.ts b/src/@generated/article/article-create-without-tags.input.ts index 77d1f33e..a06758c6 100644 --- a/src/@generated/article/article-create-without-tags.input.ts +++ b/src/@generated/article/article-create-without-tags.input.ts @@ -70,11 +70,11 @@ export class ArticleCreateWithoutTagsInput { nullable: true, description: undefined, }) - favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput | null; + favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput; @Field(() => CommentCreateManyWithoutArticleInput, { nullable: true, description: undefined, }) - comments?: CommentCreateManyWithoutArticleInput | null; + comments?: CommentCreateManyWithoutArticleInput; } diff --git a/src/@generated/article/article-create.input.ts b/src/@generated/article/article-create.input.ts index ddb6b579..feed8de3 100644 --- a/src/@generated/article/article-create.input.ts +++ b/src/@generated/article/article-create.input.ts @@ -65,7 +65,7 @@ export class ArticleCreateInput { nullable: true, description: undefined, }) - tags?: TagCreateManyWithoutArticlesInput | null; + tags?: TagCreateManyWithoutArticlesInput; @Field(() => UserCreateOneWithoutArticlesInput, { nullable: true, @@ -77,11 +77,11 @@ export class ArticleCreateInput { nullable: true, description: undefined, }) - favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput | null; + favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput; @Field(() => CommentCreateManyWithoutArticleInput, { nullable: true, description: undefined, }) - comments?: CommentCreateManyWithoutArticleInput | null; + comments?: CommentCreateManyWithoutArticleInput; } diff --git a/src/@generated/article/article-max-aggregate.output.ts b/src/@generated/article/article-max-aggregate.output.ts index e5ba0a15..4e304c72 100644 --- a/src/@generated/article/article-max-aggregate.output.ts +++ b/src/@generated/article/article-max-aggregate.output.ts @@ -6,5 +6,5 @@ export class ArticleMaxAggregate { nullable: true, description: undefined, }) - favoritesCount?: number | null; + favoritesCount?: number; } diff --git a/src/@generated/article/article-min-aggregate.output.ts b/src/@generated/article/article-min-aggregate.output.ts index fc9a0b60..fa6f0b98 100644 --- a/src/@generated/article/article-min-aggregate.output.ts +++ b/src/@generated/article/article-min-aggregate.output.ts @@ -6,5 +6,5 @@ export class ArticleMinAggregate { nullable: true, description: undefined, }) - favoritesCount?: number | null; + favoritesCount?: number; } diff --git a/src/@generated/article/article-order-by.input.ts b/src/@generated/article/article-order-by.input.ts index b0a9045b..3f99c40a 100644 --- a/src/@generated/article/article-order-by.input.ts +++ b/src/@generated/article/article-order-by.input.ts @@ -62,5 +62,5 @@ export class ArticleOrderByInput { nullable: true, description: undefined, }) - active?: SortOrder | null; + active?: SortOrder; } diff --git a/src/@generated/article/article-scalar-where.input.ts b/src/@generated/article/article-scalar-where.input.ts index 3f9ead19..a9dc4edb 100644 --- a/src/@generated/article/article-scalar-where.input.ts +++ b/src/@generated/article/article-scalar-where.input.ts @@ -17,7 +17,7 @@ export class ArticleScalarWhereInput { nullable: true, description: undefined, }) - OR?: Array; + OR?: ArticleScalarWhereInput | Array; @Field(() => [ArticleScalarWhereInput], { nullable: true, @@ -29,59 +29,59 @@ export class ArticleScalarWhereInput { nullable: true, description: undefined, }) - id?: string | StringFilter; + id?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - slug?: string | StringFilter; + slug?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - title?: string | StringFilter; + title?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - description?: string | StringFilter; + description?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - body?: string | StringFilter; + body?: StringFilter | string; @Field(() => DateTimeFilter, { nullable: true, description: undefined, }) - createdAt?: Date | string | DateTimeFilter; + createdAt?: DateTimeFilter | Date | string; @Field(() => DateTimeFilter, { nullable: true, description: undefined, }) - updatedAt?: Date | string | DateTimeFilter; + updatedAt?: DateTimeFilter | Date | string; @Field(() => IntFilter, { nullable: true, description: undefined, }) - favoritesCount?: number | IntFilter; + favoritesCount?: IntFilter | number; @Field(() => StringFilter, { nullable: true, description: undefined, }) - authorId?: string | StringFilter; + authorId?: StringFilter | string; @Field(() => BooleanFilter, { nullable: true, description: undefined, }) - active?: boolean | BooleanFilter | null; + active?: BooleanFilter | boolean | null; } diff --git a/src/@generated/article/article-sum-aggregate.output.ts b/src/@generated/article/article-sum-aggregate.output.ts index 544ce57e..d7a92592 100644 --- a/src/@generated/article/article-sum-aggregate.output.ts +++ b/src/@generated/article/article-sum-aggregate.output.ts @@ -6,5 +6,5 @@ export class ArticleSumAggregate { nullable: true, description: undefined, }) - favoritesCount?: number | null; + favoritesCount?: number; } diff --git a/src/@generated/article/article-update-many-without-author.input.ts b/src/@generated/article/article-update-many-without-author.input.ts index 35da0606..6c122f2d 100644 --- a/src/@generated/article/article-update-many-without-author.input.ts +++ b/src/@generated/article/article-update-many-without-author.input.ts @@ -13,53 +13,59 @@ export class ArticleUpdateManyWithoutAuthorInput { nullable: true, description: undefined, }) - create?: Array; + create?: ArticleCreateWithoutAuthorInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - set?: Array; + set?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - disconnect?: Array; + disconnect?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - delete?: Array; + delete?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleUpdateWithWhereUniqueWithoutAuthorInput], { nullable: true, description: undefined, }) - update?: Array; + update?: + | ArticleUpdateWithWhereUniqueWithoutAuthorInput + | Array; @Field(() => [ArticleUpdateManyWithWhereNestedInput], { nullable: true, description: undefined, }) - updateMany?: Array | null; + updateMany?: + | ArticleUpdateManyWithWhereNestedInput + | Array; @Field(() => [ArticleScalarWhereInput], { nullable: true, description: undefined, }) - deleteMany?: Array; + deleteMany?: ArticleScalarWhereInput | Array; @Field(() => [ArticleUpsertWithWhereUniqueWithoutAuthorInput], { nullable: true, description: undefined, }) - upsert?: Array; + upsert?: + | ArticleUpsertWithWhereUniqueWithoutAuthorInput + | Array; } diff --git a/src/@generated/article/article-update-many-without-favorited-by.input.ts b/src/@generated/article/article-update-many-without-favorited-by.input.ts index 64c44862..48685520 100644 --- a/src/@generated/article/article-update-many-without-favorited-by.input.ts +++ b/src/@generated/article/article-update-many-without-favorited-by.input.ts @@ -13,53 +13,59 @@ export class ArticleUpdateManyWithoutFavoritedByInput { nullable: true, description: undefined, }) - create?: Array; + create?: ArticleCreateWithoutFavoritedByInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - set?: Array; + set?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - disconnect?: Array; + disconnect?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - delete?: Array; + delete?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleUpdateWithWhereUniqueWithoutFavoritedByInput], { nullable: true, description: undefined, }) - update?: Array; + update?: + | ArticleUpdateWithWhereUniqueWithoutFavoritedByInput + | Array; @Field(() => [ArticleUpdateManyWithWhereNestedInput], { nullable: true, description: undefined, }) - updateMany?: Array | null; + updateMany?: + | ArticleUpdateManyWithWhereNestedInput + | Array; @Field(() => [ArticleScalarWhereInput], { nullable: true, description: undefined, }) - deleteMany?: Array; + deleteMany?: ArticleScalarWhereInput | Array; @Field(() => [ArticleUpsertWithWhereUniqueWithoutFavoritedByInput], { nullable: true, description: undefined, }) - upsert?: Array; + upsert?: + | ArticleUpsertWithWhereUniqueWithoutFavoritedByInput + | Array; } diff --git a/src/@generated/article/article-update-many-without-tags.input.ts b/src/@generated/article/article-update-many-without-tags.input.ts index be2ef61f..6859d4e8 100644 --- a/src/@generated/article/article-update-many-without-tags.input.ts +++ b/src/@generated/article/article-update-many-without-tags.input.ts @@ -13,53 +13,59 @@ export class ArticleUpdateManyWithoutTagsInput { nullable: true, description: undefined, }) - create?: Array; + create?: ArticleCreateWithoutTagsInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - set?: Array; + set?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - disconnect?: Array; + disconnect?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleWhereUniqueInput], { nullable: true, description: undefined, }) - delete?: Array; + delete?: ArticleWhereUniqueInput | Array; @Field(() => [ArticleUpdateWithWhereUniqueWithoutTagsInput], { nullable: true, description: undefined, }) - update?: Array; + update?: + | ArticleUpdateWithWhereUniqueWithoutTagsInput + | Array; @Field(() => [ArticleUpdateManyWithWhereNestedInput], { nullable: true, description: undefined, }) - updateMany?: Array | null; + updateMany?: + | ArticleUpdateManyWithWhereNestedInput + | Array; @Field(() => [ArticleScalarWhereInput], { nullable: true, description: undefined, }) - deleteMany?: Array; + deleteMany?: ArticleScalarWhereInput | Array; @Field(() => [ArticleUpsertWithWhereUniqueWithoutTagsInput], { nullable: true, description: undefined, }) - upsert?: Array; + upsert?: + | ArticleUpsertWithWhereUniqueWithoutTagsInput + | Array; } diff --git a/src/@generated/article/article-update-without-author-data.input.ts b/src/@generated/article/article-update-without-author-data.input.ts index 7d897319..e825bbb0 100644 --- a/src/@generated/article/article-update-without-author-data.input.ts +++ b/src/@generated/article/article-update-without-author-data.input.ts @@ -64,17 +64,17 @@ export class ArticleUpdateWithoutAuthorDataInput { nullable: true, description: undefined, }) - tags?: TagUpdateManyWithoutArticlesInput | null; + tags?: TagUpdateManyWithoutArticlesInput; @Field(() => UserUpdateManyWithoutFavoriteArticlesInput, { nullable: true, description: undefined, }) - favoritedBy?: UserUpdateManyWithoutFavoriteArticlesInput | null; + favoritedBy?: UserUpdateManyWithoutFavoriteArticlesInput; @Field(() => CommentUpdateManyWithoutArticleInput, { nullable: true, description: undefined, }) - comments?: CommentUpdateManyWithoutArticleInput | null; + comments?: CommentUpdateManyWithoutArticleInput; } diff --git a/src/@generated/article/article-update-without-comments-data.input.ts b/src/@generated/article/article-update-without-comments-data.input.ts index 888758ab..d59ef98c 100644 --- a/src/@generated/article/article-update-without-comments-data.input.ts +++ b/src/@generated/article/article-update-without-comments-data.input.ts @@ -64,7 +64,7 @@ export class ArticleUpdateWithoutCommentsDataInput { nullable: true, description: undefined, }) - tags?: TagUpdateManyWithoutArticlesInput | null; + tags?: TagUpdateManyWithoutArticlesInput; @Field(() => UserUpdateOneRequiredWithoutArticlesInput, { nullable: true, @@ -76,5 +76,5 @@ export class ArticleUpdateWithoutCommentsDataInput { nullable: true, description: undefined, }) - favoritedBy?: UserUpdateManyWithoutFavoriteArticlesInput | null; + favoritedBy?: UserUpdateManyWithoutFavoriteArticlesInput; } diff --git a/src/@generated/article/article-update-without-favorited-by-data.input.ts b/src/@generated/article/article-update-without-favorited-by-data.input.ts index 93c690f5..6558a69a 100644 --- a/src/@generated/article/article-update-without-favorited-by-data.input.ts +++ b/src/@generated/article/article-update-without-favorited-by-data.input.ts @@ -64,7 +64,7 @@ export class ArticleUpdateWithoutFavoritedByDataInput { nullable: true, description: undefined, }) - tags?: TagUpdateManyWithoutArticlesInput | null; + tags?: TagUpdateManyWithoutArticlesInput; @Field(() => UserUpdateOneRequiredWithoutArticlesInput, { nullable: true, @@ -76,5 +76,5 @@ export class ArticleUpdateWithoutFavoritedByDataInput { nullable: true, description: undefined, }) - comments?: CommentUpdateManyWithoutArticleInput | null; + comments?: CommentUpdateManyWithoutArticleInput; } diff --git a/src/@generated/article/article-update-without-tags-data.input.ts b/src/@generated/article/article-update-without-tags-data.input.ts index 3477864b..d0f182c5 100644 --- a/src/@generated/article/article-update-without-tags-data.input.ts +++ b/src/@generated/article/article-update-without-tags-data.input.ts @@ -70,11 +70,11 @@ export class ArticleUpdateWithoutTagsDataInput { nullable: true, description: undefined, }) - favoritedBy?: UserUpdateManyWithoutFavoriteArticlesInput | null; + favoritedBy?: UserUpdateManyWithoutFavoriteArticlesInput; @Field(() => CommentUpdateManyWithoutArticleInput, { nullable: true, description: undefined, }) - comments?: CommentUpdateManyWithoutArticleInput | null; + comments?: CommentUpdateManyWithoutArticleInput; } diff --git a/src/@generated/article/article-update.input.ts b/src/@generated/article/article-update.input.ts index b8d6d369..0222b32c 100644 --- a/src/@generated/article/article-update.input.ts +++ b/src/@generated/article/article-update.input.ts @@ -65,7 +65,7 @@ export class ArticleUpdateInput { nullable: true, description: undefined, }) - tags?: TagUpdateManyWithoutArticlesInput | null; + tags?: TagUpdateManyWithoutArticlesInput; @Field(() => UserUpdateOneRequiredWithoutArticlesInput, { nullable: true, @@ -77,11 +77,11 @@ export class ArticleUpdateInput { nullable: true, description: undefined, }) - favoritedBy?: UserUpdateManyWithoutFavoriteArticlesInput | null; + favoritedBy?: UserUpdateManyWithoutFavoriteArticlesInput; @Field(() => CommentUpdateManyWithoutArticleInput, { nullable: true, description: undefined, }) - comments?: CommentUpdateManyWithoutArticleInput | null; + comments?: CommentUpdateManyWithoutArticleInput; } diff --git a/src/@generated/article/article-where.input.ts b/src/@generated/article/article-where.input.ts index acaab871..4c5c888d 100644 --- a/src/@generated/article/article-where.input.ts +++ b/src/@generated/article/article-where.input.ts @@ -7,6 +7,7 @@ import { IntFilter } from '../prisma/int-filter.input'; import { StringFilter } from '../prisma/string-filter.input'; import { TagListRelationFilter } from '../tag/tag-list-relation-filter.input'; import { UserListRelationFilter } from '../user/user-list-relation-filter.input'; +import { UserRelationFilter } from '../user/user-relation-filter.input'; import { UserWhereInput } from '../user/user-where.input'; @InputType() @@ -21,7 +22,7 @@ export class ArticleWhereInput { nullable: true, description: undefined, }) - OR?: Array; + OR?: ArticleWhereInput | Array; @Field(() => [ArticleWhereInput], { nullable: true, @@ -33,83 +34,83 @@ export class ArticleWhereInput { nullable: true, description: undefined, }) - id?: string | StringFilter; + id?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - slug?: string | StringFilter; + slug?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - title?: string | StringFilter; + title?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - description?: string | StringFilter; + description?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - body?: string | StringFilter; + body?: StringFilter | string; @Field(() => TagListRelationFilter, { nullable: true, description: undefined, }) - tags?: TagListRelationFilter | null; + tags?: TagListRelationFilter; @Field(() => DateTimeFilter, { nullable: true, description: undefined, }) - createdAt?: Date | string | DateTimeFilter; + createdAt?: DateTimeFilter | Date | string; @Field(() => DateTimeFilter, { nullable: true, description: undefined, }) - updatedAt?: Date | string | DateTimeFilter; + updatedAt?: DateTimeFilter | Date | string; @Field(() => IntFilter, { nullable: true, description: undefined, }) - favoritesCount?: number | IntFilter; + favoritesCount?: IntFilter | number; @Field(() => UserWhereInput, { nullable: true, description: undefined, }) - author?: UserWhereInput; + author?: UserRelationFilter | UserWhereInput; @Field(() => StringFilter, { nullable: true, description: undefined, }) - authorId?: string | StringFilter; + authorId?: StringFilter | string; @Field(() => UserListRelationFilter, { nullable: true, description: undefined, }) - favoritedBy?: UserListRelationFilter | null; + favoritedBy?: UserListRelationFilter; @Field(() => CommentListRelationFilter, { nullable: true, description: undefined, }) - comments?: CommentListRelationFilter | null; + comments?: CommentListRelationFilter; @Field(() => BooleanFilter, { nullable: true, description: undefined, }) - active?: boolean | BooleanFilter | null; + active?: BooleanFilter | boolean | null; } diff --git a/src/@generated/article/article.model.ts b/src/@generated/article/article.model.ts index 6d0b9a9b..9faf5abe 100644 --- a/src/@generated/article/article.model.ts +++ b/src/@generated/article/article.model.ts @@ -42,7 +42,7 @@ export class Article { nullable: true, description: undefined, }) - tags?: Tag[] | null; + tags?: Array; @Field(() => String, { nullable: false, @@ -79,18 +79,18 @@ export class Article { nullable: true, description: undefined, }) - favoritedBy?: User[] | null; + favoritedBy?: Array; @Field(() => [Comment], { nullable: true, description: undefined, }) - comments?: Comment[] | null; + comments?: Array; @Field(() => Boolean, { nullable: true, defaultValue: true, description: undefined, }) - active?: boolean | null; + active?: boolean; } diff --git a/src/@generated/article/find-first-article.args.ts b/src/@generated/article/find-first-article.args.ts new file mode 100644 index 00000000..a1aa9714 --- /dev/null +++ b/src/@generated/article/find-first-article.args.ts @@ -0,0 +1,45 @@ +import { ArgsType, Field, Int } from '@nestjs/graphql'; + +import { ArticleDistinctFieldEnum } from './article-distinct-field.enum'; +import { ArticleOrderByInput } from './article-order-by.input'; +import { ArticleWhereUniqueInput } from './article-where-unique.input'; +import { ArticleWhereInput } from './article-where.input'; + +@ArgsType() +export class FindFirstArticleArgs { + @Field(() => ArticleWhereInput, { + nullable: true, + description: undefined, + }) + where?: ArticleWhereInput; + + @Field(() => [ArticleOrderByInput], { + nullable: true, + description: undefined, + }) + orderBy?: Array | ArticleOrderByInput; + + @Field(() => ArticleWhereUniqueInput, { + nullable: true, + description: undefined, + }) + cursor?: ArticleWhereUniqueInput; + + @Field(() => Int, { + nullable: true, + description: undefined, + }) + take?: number; + + @Field(() => Int, { + nullable: true, + description: undefined, + }) + skip?: number; + + @Field(() => [ArticleDistinctFieldEnum], { + nullable: true, + description: undefined, + }) + distinct?: Array; +} diff --git a/src/@generated/article/find-many-article.args.ts b/src/@generated/article/find-many-article.args.ts index 971dd088..e1249208 100644 --- a/src/@generated/article/find-many-article.args.ts +++ b/src/@generated/article/find-many-article.args.ts @@ -17,7 +17,7 @@ export class FindManyArticleArgs { nullable: true, description: undefined, }) - orderBy?: Array; + orderBy?: Array | ArticleOrderByInput; @Field(() => ArticleWhereUniqueInput, { nullable: true, diff --git a/src/@generated/comment/aggregate-comment.args.ts b/src/@generated/comment/aggregate-comment.args.ts index 8b70e4b1..41c7f88a 100644 --- a/src/@generated/comment/aggregate-comment.args.ts +++ b/src/@generated/comment/aggregate-comment.args.ts @@ -17,7 +17,7 @@ export class AggregateCommentArgs { nullable: true, description: undefined, }) - orderBy?: Array; + orderBy?: Array | CommentOrderByInput; @Field(() => CommentWhereUniqueInput, { nullable: true, @@ -47,5 +47,5 @@ export class AggregateCommentArgs { nullable: true, description: undefined, }) - count?: true | null; + count?: true; } diff --git a/src/@generated/comment/aggregate-comment.output.ts b/src/@generated/comment/aggregate-comment.output.ts index 990a64c8..ddbc8871 100644 --- a/src/@generated/comment/aggregate-comment.output.ts +++ b/src/@generated/comment/aggregate-comment.output.ts @@ -6,5 +6,5 @@ export class AggregateComment { nullable: true, description: undefined, }) - count?: number | null; + count?: number; } diff --git a/src/@generated/comment/comment-create-many-without-article.input.ts b/src/@generated/comment/comment-create-many-without-article.input.ts index a1abf601..a6c6f8f4 100644 --- a/src/@generated/comment/comment-create-many-without-article.input.ts +++ b/src/@generated/comment/comment-create-many-without-article.input.ts @@ -9,11 +9,11 @@ export class CommentCreateManyWithoutArticleInput { nullable: true, description: undefined, }) - create?: Array; + create?: CommentCreateWithoutArticleInput | Array; @Field(() => [CommentWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: CommentWhereUniqueInput | Array; } diff --git a/src/@generated/comment/comment-create-many-without-author.input.ts b/src/@generated/comment/comment-create-many-without-author.input.ts index 07f1feef..988d9bb6 100644 --- a/src/@generated/comment/comment-create-many-without-author.input.ts +++ b/src/@generated/comment/comment-create-many-without-author.input.ts @@ -9,11 +9,11 @@ export class CommentCreateManyWithoutAuthorInput { nullable: true, description: undefined, }) - create?: Array; + create?: CommentCreateWithoutAuthorInput | Array; @Field(() => [CommentWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: CommentWhereUniqueInput | Array; } diff --git a/src/@generated/comment/comment-create-without-author.input.ts b/src/@generated/comment/comment-create-without-author.input.ts index 60d80b53..1e3f3dd7 100644 --- a/src/@generated/comment/comment-create-without-author.input.ts +++ b/src/@generated/comment/comment-create-without-author.input.ts @@ -32,5 +32,5 @@ export class CommentCreateWithoutAuthorInput { nullable: true, description: undefined, }) - article?: ArticleCreateOneWithoutCommentsInput | null; + article?: ArticleCreateOneWithoutCommentsInput; } diff --git a/src/@generated/comment/comment-create.input.ts b/src/@generated/comment/comment-create.input.ts index d42153cf..f5a793ad 100644 --- a/src/@generated/comment/comment-create.input.ts +++ b/src/@generated/comment/comment-create.input.ts @@ -39,5 +39,5 @@ export class CommentCreateInput { nullable: true, description: undefined, }) - article?: ArticleCreateOneWithoutCommentsInput | null; + article?: ArticleCreateOneWithoutCommentsInput; } diff --git a/src/@generated/comment/comment-order-by.input.ts b/src/@generated/comment/comment-order-by.input.ts index be6ce68e..69d8f624 100644 --- a/src/@generated/comment/comment-order-by.input.ts +++ b/src/@generated/comment/comment-order-by.input.ts @@ -38,5 +38,5 @@ export class CommentOrderByInput { nullable: true, description: undefined, }) - articleId?: SortOrder | null; + articleId?: SortOrder; } diff --git a/src/@generated/comment/comment-scalar-where.input.ts b/src/@generated/comment/comment-scalar-where.input.ts index c5f67d2a..c53284bd 100644 --- a/src/@generated/comment/comment-scalar-where.input.ts +++ b/src/@generated/comment/comment-scalar-where.input.ts @@ -15,7 +15,7 @@ export class CommentScalarWhereInput { nullable: true, description: undefined, }) - OR?: Array; + OR?: CommentScalarWhereInput | Array; @Field(() => [CommentScalarWhereInput], { nullable: true, @@ -27,35 +27,35 @@ export class CommentScalarWhereInput { nullable: true, description: undefined, }) - id?: string | StringFilter; + id?: StringFilter | string; @Field(() => DateTimeFilter, { nullable: true, description: undefined, }) - createdAt?: Date | string | DateTimeFilter; + createdAt?: DateTimeFilter | Date | string; @Field(() => DateTimeFilter, { nullable: true, description: undefined, }) - updatedAt?: Date | string | DateTimeFilter; + updatedAt?: DateTimeFilter | Date | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - body?: string | StringFilter; + body?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - authorId?: string | StringFilter; + authorId?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - articleId?: string | StringFilter | null; + articleId?: StringFilter | string | null; } diff --git a/src/@generated/comment/comment-update-many-without-article.input.ts b/src/@generated/comment/comment-update-many-without-article.input.ts index 2687b31a..93760197 100644 --- a/src/@generated/comment/comment-update-many-without-article.input.ts +++ b/src/@generated/comment/comment-update-many-without-article.input.ts @@ -13,53 +13,59 @@ export class CommentUpdateManyWithoutArticleInput { nullable: true, description: undefined, }) - create?: Array; + create?: CommentCreateWithoutArticleInput | Array; @Field(() => [CommentWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: CommentWhereUniqueInput | Array; @Field(() => [CommentWhereUniqueInput], { nullable: true, description: undefined, }) - set?: Array; + set?: CommentWhereUniqueInput | Array; @Field(() => [CommentWhereUniqueInput], { nullable: true, description: undefined, }) - disconnect?: Array; + disconnect?: CommentWhereUniqueInput | Array; @Field(() => [CommentWhereUniqueInput], { nullable: true, description: undefined, }) - delete?: Array; + delete?: CommentWhereUniqueInput | Array; @Field(() => [CommentUpdateWithWhereUniqueWithoutArticleInput], { nullable: true, description: undefined, }) - update?: Array; + update?: + | CommentUpdateWithWhereUniqueWithoutArticleInput + | Array; @Field(() => [CommentUpdateManyWithWhereNestedInput], { nullable: true, description: undefined, }) - updateMany?: Array | null; + updateMany?: + | CommentUpdateManyWithWhereNestedInput + | Array; @Field(() => [CommentScalarWhereInput], { nullable: true, description: undefined, }) - deleteMany?: Array; + deleteMany?: CommentScalarWhereInput | Array; @Field(() => [CommentUpsertWithWhereUniqueWithoutArticleInput], { nullable: true, description: undefined, }) - upsert?: Array; + upsert?: + | CommentUpsertWithWhereUniqueWithoutArticleInput + | Array; } diff --git a/src/@generated/comment/comment-update-many-without-author.input.ts b/src/@generated/comment/comment-update-many-without-author.input.ts index 1dd7080c..c4e69a05 100644 --- a/src/@generated/comment/comment-update-many-without-author.input.ts +++ b/src/@generated/comment/comment-update-many-without-author.input.ts @@ -13,53 +13,59 @@ export class CommentUpdateManyWithoutAuthorInput { nullable: true, description: undefined, }) - create?: Array; + create?: CommentCreateWithoutAuthorInput | Array; @Field(() => [CommentWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: CommentWhereUniqueInput | Array; @Field(() => [CommentWhereUniqueInput], { nullable: true, description: undefined, }) - set?: Array; + set?: CommentWhereUniqueInput | Array; @Field(() => [CommentWhereUniqueInput], { nullable: true, description: undefined, }) - disconnect?: Array; + disconnect?: CommentWhereUniqueInput | Array; @Field(() => [CommentWhereUniqueInput], { nullable: true, description: undefined, }) - delete?: Array; + delete?: CommentWhereUniqueInput | Array; @Field(() => [CommentUpdateWithWhereUniqueWithoutAuthorInput], { nullable: true, description: undefined, }) - update?: Array; + update?: + | CommentUpdateWithWhereUniqueWithoutAuthorInput + | Array; @Field(() => [CommentUpdateManyWithWhereNestedInput], { nullable: true, description: undefined, }) - updateMany?: Array | null; + updateMany?: + | CommentUpdateManyWithWhereNestedInput + | Array; @Field(() => [CommentScalarWhereInput], { nullable: true, description: undefined, }) - deleteMany?: Array; + deleteMany?: CommentScalarWhereInput | Array; @Field(() => [CommentUpsertWithWhereUniqueWithoutAuthorInput], { nullable: true, description: undefined, }) - upsert?: Array; + upsert?: + | CommentUpsertWithWhereUniqueWithoutAuthorInput + | Array; } diff --git a/src/@generated/comment/comment-update-without-author-data.input.ts b/src/@generated/comment/comment-update-without-author-data.input.ts index 258b95f5..b698334c 100644 --- a/src/@generated/comment/comment-update-without-author-data.input.ts +++ b/src/@generated/comment/comment-update-without-author-data.input.ts @@ -32,5 +32,5 @@ export class CommentUpdateWithoutAuthorDataInput { nullable: true, description: undefined, }) - article?: ArticleUpdateOneWithoutCommentsInput | null; + article?: ArticleUpdateOneWithoutCommentsInput; } diff --git a/src/@generated/comment/comment-update.input.ts b/src/@generated/comment/comment-update.input.ts index 0bf54834..bffed564 100644 --- a/src/@generated/comment/comment-update.input.ts +++ b/src/@generated/comment/comment-update.input.ts @@ -39,5 +39,5 @@ export class CommentUpdateInput { nullable: true, description: undefined, }) - article?: ArticleUpdateOneWithoutCommentsInput | null; + article?: ArticleUpdateOneWithoutCommentsInput; } diff --git a/src/@generated/comment/comment-where.input.ts b/src/@generated/comment/comment-where.input.ts index 5a30af18..e504cb5f 100644 --- a/src/@generated/comment/comment-where.input.ts +++ b/src/@generated/comment/comment-where.input.ts @@ -1,8 +1,10 @@ import { Field, InputType } from '@nestjs/graphql'; +import { ArticleRelationFilter } from '../article/article-relation-filter.input'; import { ArticleWhereInput } from '../article/article-where.input'; import { DateTimeFilter } from '../prisma/date-time-filter.input'; import { StringFilter } from '../prisma/string-filter.input'; +import { UserRelationFilter } from '../user/user-relation-filter.input'; import { UserWhereInput } from '../user/user-where.input'; @InputType() @@ -17,7 +19,7 @@ export class CommentWhereInput { nullable: true, description: undefined, }) - OR?: Array; + OR?: CommentWhereInput | Array; @Field(() => [CommentWhereInput], { nullable: true, @@ -29,47 +31,47 @@ export class CommentWhereInput { nullable: true, description: undefined, }) - id?: string | StringFilter; + id?: StringFilter | string; @Field(() => DateTimeFilter, { nullable: true, description: undefined, }) - createdAt?: Date | string | DateTimeFilter; + createdAt?: DateTimeFilter | Date | string; @Field(() => DateTimeFilter, { nullable: true, description: undefined, }) - updatedAt?: Date | string | DateTimeFilter; + updatedAt?: DateTimeFilter | Date | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - body?: string | StringFilter; + body?: StringFilter | string; @Field(() => UserWhereInput, { nullable: true, description: undefined, }) - author?: UserWhereInput; + author?: UserRelationFilter | UserWhereInput; @Field(() => StringFilter, { nullable: true, description: undefined, }) - authorId?: string | StringFilter; + authorId?: StringFilter | string; @Field(() => ArticleWhereInput, { nullable: true, description: undefined, }) - article?: ArticleWhereInput | null; + article?: ArticleRelationFilter | ArticleWhereInput | null; @Field(() => StringFilter, { nullable: true, description: undefined, }) - articleId?: string | StringFilter | null; + articleId?: StringFilter | string | null; } diff --git a/src/@generated/comment/comment.model.ts b/src/@generated/comment/comment.model.ts index 87db43da..4dac6ff9 100644 --- a/src/@generated/comment/comment.model.ts +++ b/src/@generated/comment/comment.model.ts @@ -47,11 +47,11 @@ export class Comment { nullable: true, description: undefined, }) - article?: Article | null; + article?: Article; @Field(() => String, { nullable: true, description: undefined, }) - readonly articleId?: string | null; + readonly articleId?: string; } diff --git a/src/@generated/comment/find-first-comment.args.ts b/src/@generated/comment/find-first-comment.args.ts new file mode 100644 index 00000000..afbfe208 --- /dev/null +++ b/src/@generated/comment/find-first-comment.args.ts @@ -0,0 +1,45 @@ +import { ArgsType, Field, Int } from '@nestjs/graphql'; + +import { CommentDistinctFieldEnum } from './comment-distinct-field.enum'; +import { CommentOrderByInput } from './comment-order-by.input'; +import { CommentWhereUniqueInput } from './comment-where-unique.input'; +import { CommentWhereInput } from './comment-where.input'; + +@ArgsType() +export class FindFirstCommentArgs { + @Field(() => CommentWhereInput, { + nullable: true, + description: undefined, + }) + where?: CommentWhereInput; + + @Field(() => [CommentOrderByInput], { + nullable: true, + description: undefined, + }) + orderBy?: Array | CommentOrderByInput; + + @Field(() => CommentWhereUniqueInput, { + nullable: true, + description: undefined, + }) + cursor?: CommentWhereUniqueInput; + + @Field(() => Int, { + nullable: true, + description: undefined, + }) + take?: number; + + @Field(() => Int, { + nullable: true, + description: undefined, + }) + skip?: number; + + @Field(() => [CommentDistinctFieldEnum], { + nullable: true, + description: undefined, + }) + distinct?: Array; +} diff --git a/src/@generated/comment/find-many-comment.args.ts b/src/@generated/comment/find-many-comment.args.ts index db6a225e..b7d769b4 100644 --- a/src/@generated/comment/find-many-comment.args.ts +++ b/src/@generated/comment/find-many-comment.args.ts @@ -17,7 +17,7 @@ export class FindManyCommentArgs { nullable: true, description: undefined, }) - orderBy?: Array; + orderBy?: Array | CommentOrderByInput; @Field(() => CommentWhereUniqueInput, { nullable: true, diff --git a/src/@generated/prisma/batch-payload.output.ts b/src/@generated/prisma/batch-payload.output.ts index 512bc002..be11c9d0 100644 --- a/src/@generated/prisma/batch-payload.output.ts +++ b/src/@generated/prisma/batch-payload.output.ts @@ -6,5 +6,5 @@ export class BatchPayload { nullable: true, description: undefined, }) - count?: number | null; + count?: number; } diff --git a/src/@generated/prisma/date-time-filter.input.ts b/src/@generated/prisma/date-time-filter.input.ts index cd03ce36..e408ac8e 100644 --- a/src/@generated/prisma/date-time-filter.input.ts +++ b/src/@generated/prisma/date-time-filter.input.ts @@ -12,13 +12,13 @@ export class DateTimeFilter { nullable: true, description: undefined, }) - in?: Date | string | Array; + in?: Array; @Field(() => [String], { nullable: true, description: undefined, }) - notIn?: Date | string | Array; + notIn?: Array; @Field(() => String, { nullable: true, @@ -48,5 +48,5 @@ export class DateTimeFilter { nullable: true, description: undefined, }) - not?: Date | string | DateTimeFilter | null; + not?: Date | string | DateTimeFilter; } diff --git a/src/@generated/prisma/float-filter.input.ts b/src/@generated/prisma/float-filter.input.ts index f72a9fbd..8689fb67 100644 --- a/src/@generated/prisma/float-filter.input.ts +++ b/src/@generated/prisma/float-filter.input.ts @@ -12,37 +12,37 @@ export class FloatFilter { nullable: true, description: undefined, }) - in?: number | Array | null; + in?: Array | null; @Field(() => [Float], { nullable: true, description: undefined, }) - notIn?: number | Array | null; + notIn?: Array | null; @Field(() => Float, { nullable: true, description: undefined, }) - lt?: number | null; + lt?: number; @Field(() => Float, { nullable: true, description: undefined, }) - lte?: number | null; + lte?: number; @Field(() => Float, { nullable: true, description: undefined, }) - gt?: number | null; + gt?: number; @Field(() => Float, { nullable: true, description: undefined, }) - gte?: number | null; + gte?: number; @Field(() => FloatFilter, { nullable: true, diff --git a/src/@generated/prisma/int-filter.input.ts b/src/@generated/prisma/int-filter.input.ts index bc86e0c4..59fbc7b3 100644 --- a/src/@generated/prisma/int-filter.input.ts +++ b/src/@generated/prisma/int-filter.input.ts @@ -12,13 +12,13 @@ export class IntFilter { nullable: true, description: undefined, }) - in?: number | Array; + in?: Array; @Field(() => [Int], { nullable: true, description: undefined, }) - notIn?: number | Array; + notIn?: Array; @Field(() => Int, { nullable: true, @@ -48,5 +48,5 @@ export class IntFilter { nullable: true, description: undefined, }) - not?: number | IntFilter | null; + not?: number | IntFilter; } diff --git a/src/@generated/prisma/query-mode.enum.ts b/src/@generated/prisma/query-mode.enum.ts new file mode 100644 index 00000000..baf577cb --- /dev/null +++ b/src/@generated/prisma/query-mode.enum.ts @@ -0,0 +1,8 @@ +import { registerEnumType } from '@nestjs/graphql'; + +export enum QueryMode { + 'default' = 'default', + insensitive = 'insensitive', +} + +registerEnumType(QueryMode, { name: 'QueryMode', description: undefined }); diff --git a/src/@generated/prisma/string-filter.input.ts b/src/@generated/prisma/string-filter.input.ts index 335e9a0d..161fe4e9 100644 --- a/src/@generated/prisma/string-filter.input.ts +++ b/src/@generated/prisma/string-filter.input.ts @@ -1,5 +1,7 @@ import { Field, InputType } from '@nestjs/graphql'; +import { QueryMode } from './query-mode.enum'; + @InputType() export class StringFilter { @Field(() => String, { @@ -12,13 +14,13 @@ export class StringFilter { nullable: true, description: undefined, }) - in?: string | Array; + in?: Array; @Field(() => [String], { nullable: true, description: undefined, }) - notIn?: string | Array; + notIn?: Array; @Field(() => String, { nullable: true, @@ -62,9 +64,15 @@ export class StringFilter { }) endsWith?: string; + @Field(() => QueryMode, { + nullable: true, + description: undefined, + }) + mode?: QueryMode; + @Field(() => StringFilter, { nullable: true, description: undefined, }) - not?: string | StringFilter | null; + not?: string | StringFilter; } diff --git a/src/@generated/tag/aggregate-tag.args.ts b/src/@generated/tag/aggregate-tag.args.ts index 1fd77dd9..92970385 100644 --- a/src/@generated/tag/aggregate-tag.args.ts +++ b/src/@generated/tag/aggregate-tag.args.ts @@ -17,7 +17,7 @@ export class AggregateTagArgs { nullable: true, description: undefined, }) - orderBy?: Array; + orderBy?: Array | TagOrderByInput; @Field(() => TagWhereUniqueInput, { nullable: true, @@ -47,5 +47,5 @@ export class AggregateTagArgs { nullable: true, description: undefined, }) - count?: true | null; + count?: true; } diff --git a/src/@generated/tag/aggregate-tag.output.ts b/src/@generated/tag/aggregate-tag.output.ts index 35978562..646e00c5 100644 --- a/src/@generated/tag/aggregate-tag.output.ts +++ b/src/@generated/tag/aggregate-tag.output.ts @@ -6,5 +6,5 @@ export class AggregateTag { nullable: true, description: undefined, }) - count?: number | null; + count?: number; } diff --git a/src/@generated/tag/find-first-tag.args.ts b/src/@generated/tag/find-first-tag.args.ts new file mode 100644 index 00000000..8b6562af --- /dev/null +++ b/src/@generated/tag/find-first-tag.args.ts @@ -0,0 +1,45 @@ +import { ArgsType, Field, Int } from '@nestjs/graphql'; + +import { TagDistinctFieldEnum } from './tag-distinct-field.enum'; +import { TagOrderByInput } from './tag-order-by.input'; +import { TagWhereUniqueInput } from './tag-where-unique.input'; +import { TagWhereInput } from './tag-where.input'; + +@ArgsType() +export class FindFirstTagArgs { + @Field(() => TagWhereInput, { + nullable: true, + description: undefined, + }) + where?: TagWhereInput; + + @Field(() => [TagOrderByInput], { + nullable: true, + description: undefined, + }) + orderBy?: Array | TagOrderByInput; + + @Field(() => TagWhereUniqueInput, { + nullable: true, + description: undefined, + }) + cursor?: TagWhereUniqueInput; + + @Field(() => Int, { + nullable: true, + description: undefined, + }) + take?: number; + + @Field(() => Int, { + nullable: true, + description: undefined, + }) + skip?: number; + + @Field(() => [TagDistinctFieldEnum], { + nullable: true, + description: undefined, + }) + distinct?: Array; +} diff --git a/src/@generated/tag/find-many-tag.args.ts b/src/@generated/tag/find-many-tag.args.ts index e587553a..61fd1f28 100644 --- a/src/@generated/tag/find-many-tag.args.ts +++ b/src/@generated/tag/find-many-tag.args.ts @@ -17,7 +17,7 @@ export class FindManyTagArgs { nullable: true, description: undefined, }) - orderBy?: Array; + orderBy?: Array | TagOrderByInput; @Field(() => TagWhereUniqueInput, { nullable: true, diff --git a/src/@generated/tag/tag-create-many-without-articles.input.ts b/src/@generated/tag/tag-create-many-without-articles.input.ts index f48bce5c..2fa6438e 100644 --- a/src/@generated/tag/tag-create-many-without-articles.input.ts +++ b/src/@generated/tag/tag-create-many-without-articles.input.ts @@ -9,11 +9,11 @@ export class TagCreateManyWithoutArticlesInput { nullable: true, description: undefined, }) - create?: Array; + create?: TagCreateWithoutArticlesInput | Array; @Field(() => [TagWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: TagWhereUniqueInput | Array; } diff --git a/src/@generated/tag/tag-create.input.ts b/src/@generated/tag/tag-create.input.ts index 46e897fc..0d398fc6 100644 --- a/src/@generated/tag/tag-create.input.ts +++ b/src/@generated/tag/tag-create.input.ts @@ -20,5 +20,5 @@ export class TagCreateInput { nullable: true, description: undefined, }) - articles?: ArticleCreateManyWithoutTagsInput | null; + articles?: ArticleCreateManyWithoutTagsInput; } diff --git a/src/@generated/tag/tag-scalar-where.input.ts b/src/@generated/tag/tag-scalar-where.input.ts index 73ef10d4..a9b5effc 100644 --- a/src/@generated/tag/tag-scalar-where.input.ts +++ b/src/@generated/tag/tag-scalar-where.input.ts @@ -14,7 +14,7 @@ export class TagScalarWhereInput { nullable: true, description: undefined, }) - OR?: Array; + OR?: TagScalarWhereInput | Array; @Field(() => [TagScalarWhereInput], { nullable: true, @@ -26,11 +26,11 @@ export class TagScalarWhereInput { nullable: true, description: undefined, }) - id?: string | StringFilter; + id?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - name?: string | StringFilter; + name?: StringFilter | string; } diff --git a/src/@generated/tag/tag-update-many-without-articles.input.ts b/src/@generated/tag/tag-update-many-without-articles.input.ts index 92a5868c..d45e9636 100644 --- a/src/@generated/tag/tag-update-many-without-articles.input.ts +++ b/src/@generated/tag/tag-update-many-without-articles.input.ts @@ -13,53 +13,57 @@ export class TagUpdateManyWithoutArticlesInput { nullable: true, description: undefined, }) - create?: Array; + create?: TagCreateWithoutArticlesInput | Array; @Field(() => [TagWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: TagWhereUniqueInput | Array; @Field(() => [TagWhereUniqueInput], { nullable: true, description: undefined, }) - set?: Array; + set?: TagWhereUniqueInput | Array; @Field(() => [TagWhereUniqueInput], { nullable: true, description: undefined, }) - disconnect?: Array; + disconnect?: TagWhereUniqueInput | Array; @Field(() => [TagWhereUniqueInput], { nullable: true, description: undefined, }) - delete?: Array; + delete?: TagWhereUniqueInput | Array; @Field(() => [TagUpdateWithWhereUniqueWithoutArticlesInput], { nullable: true, description: undefined, }) - update?: Array; + update?: + | TagUpdateWithWhereUniqueWithoutArticlesInput + | Array; @Field(() => [TagUpdateManyWithWhereNestedInput], { nullable: true, description: undefined, }) - updateMany?: Array | null; + updateMany?: TagUpdateManyWithWhereNestedInput | Array; @Field(() => [TagScalarWhereInput], { nullable: true, description: undefined, }) - deleteMany?: Array; + deleteMany?: TagScalarWhereInput | Array; @Field(() => [TagUpsertWithWhereUniqueWithoutArticlesInput], { nullable: true, description: undefined, }) - upsert?: Array; + upsert?: + | TagUpsertWithWhereUniqueWithoutArticlesInput + | Array; } diff --git a/src/@generated/tag/tag-update.input.ts b/src/@generated/tag/tag-update.input.ts index e80b0e3b..bcf0aff0 100644 --- a/src/@generated/tag/tag-update.input.ts +++ b/src/@generated/tag/tag-update.input.ts @@ -20,5 +20,5 @@ export class TagUpdateInput { nullable: true, description: undefined, }) - articles?: ArticleUpdateManyWithoutTagsInput | null; + articles?: ArticleUpdateManyWithoutTagsInput; } diff --git a/src/@generated/tag/tag-where.input.ts b/src/@generated/tag/tag-where.input.ts index 13ee7da3..2b4bbaeb 100644 --- a/src/@generated/tag/tag-where.input.ts +++ b/src/@generated/tag/tag-where.input.ts @@ -15,7 +15,7 @@ export class TagWhereInput { nullable: true, description: undefined, }) - OR?: Array; + OR?: TagWhereInput | Array; @Field(() => [TagWhereInput], { nullable: true, @@ -27,17 +27,17 @@ export class TagWhereInput { nullable: true, description: undefined, }) - id?: string | StringFilter; + id?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - name?: string | StringFilter; + name?: StringFilter | string; @Field(() => ArticleListRelationFilter, { nullable: true, description: undefined, }) - articles?: ArticleListRelationFilter | null; + articles?: ArticleListRelationFilter; } diff --git a/src/@generated/tag/tag.model.ts b/src/@generated/tag/tag.model.ts index 73a22d3c..bacce986 100644 --- a/src/@generated/tag/tag.model.ts +++ b/src/@generated/tag/tag.model.ts @@ -22,5 +22,5 @@ export class Tag { nullable: true, description: undefined, }) - articles?: Article[] | null; + articles?: Array
; } diff --git a/src/@generated/user/aggregate-user.args.ts b/src/@generated/user/aggregate-user.args.ts index 6114bc7a..de596298 100644 --- a/src/@generated/user/aggregate-user.args.ts +++ b/src/@generated/user/aggregate-user.args.ts @@ -21,7 +21,7 @@ export class AggregateUserArgs { nullable: true, description: undefined, }) - orderBy?: Array; + orderBy?: Array | UserOrderByInput; @Field(() => UserWhereUniqueInput, { nullable: true, @@ -51,29 +51,29 @@ export class AggregateUserArgs { nullable: true, description: undefined, }) - count?: true | null; + count?: true; @Field(() => UserAvgAggregateInput, { nullable: true, description: undefined, }) - avg?: UserAvgAggregateInput | null; + avg?: UserAvgAggregateInput; @Field(() => UserSumAggregateInput, { nullable: true, description: undefined, }) - sum?: UserSumAggregateInput | null; + sum?: UserSumAggregateInput; @Field(() => UserMinAggregateInput, { nullable: true, description: undefined, }) - min?: UserMinAggregateInput | null; + min?: UserMinAggregateInput; @Field(() => UserMaxAggregateInput, { nullable: true, description: undefined, }) - max?: UserMaxAggregateInput | null; + max?: UserMaxAggregateInput; } diff --git a/src/@generated/user/aggregate-user.output.ts b/src/@generated/user/aggregate-user.output.ts index b365ce4a..16f5daf4 100644 --- a/src/@generated/user/aggregate-user.output.ts +++ b/src/@generated/user/aggregate-user.output.ts @@ -11,29 +11,29 @@ export class AggregateUser { nullable: true, description: undefined, }) - count?: number | null; + count?: number; @Field(() => UserAvgAggregate, { nullable: true, description: undefined, }) - avg?: UserAvgAggregate | null; + avg?: UserAvgAggregate; @Field(() => UserSumAggregate, { nullable: true, description: undefined, }) - sum?: UserSumAggregate | null; + sum?: UserSumAggregate; @Field(() => UserMinAggregate, { nullable: true, description: undefined, }) - min?: UserMinAggregate | null; + min?: UserMinAggregate; @Field(() => UserMaxAggregate, { nullable: true, description: undefined, }) - max?: UserMaxAggregate | null; + max?: UserMaxAggregate; } diff --git a/src/@generated/user/find-first-user.args.ts b/src/@generated/user/find-first-user.args.ts new file mode 100644 index 00000000..480266c8 --- /dev/null +++ b/src/@generated/user/find-first-user.args.ts @@ -0,0 +1,45 @@ +import { ArgsType, Field, Int } from '@nestjs/graphql'; + +import { UserDistinctFieldEnum } from './user-distinct-field.enum'; +import { UserOrderByInput } from './user-order-by.input'; +import { UserWhereUniqueInput } from './user-where-unique.input'; +import { UserWhereInput } from './user-where.input'; + +@ArgsType() +export class FindFirstUserArgs { + @Field(() => UserWhereInput, { + nullable: true, + description: undefined, + }) + where?: UserWhereInput; + + @Field(() => [UserOrderByInput], { + nullable: true, + description: undefined, + }) + orderBy?: Array | UserOrderByInput; + + @Field(() => UserWhereUniqueInput, { + nullable: true, + description: undefined, + }) + cursor?: UserWhereUniqueInput; + + @Field(() => Int, { + nullable: true, + description: undefined, + }) + take?: number; + + @Field(() => Int, { + nullable: true, + description: undefined, + }) + skip?: number; + + @Field(() => [UserDistinctFieldEnum], { + nullable: true, + description: undefined, + }) + distinct?: Array; +} diff --git a/src/@generated/user/find-many-user.args.ts b/src/@generated/user/find-many-user.args.ts index 236c6169..ab5aae20 100644 --- a/src/@generated/user/find-many-user.args.ts +++ b/src/@generated/user/find-many-user.args.ts @@ -17,7 +17,7 @@ export class FindManyUserArgs { nullable: true, description: undefined, }) - orderBy?: Array; + orderBy?: Array | UserOrderByInput; @Field(() => UserWhereUniqueInput, { nullable: true, diff --git a/src/@generated/user/user-avg-aggregate.input.ts b/src/@generated/user/user-avg-aggregate.input.ts index 9f8b493b..c8230266 100644 --- a/src/@generated/user/user-avg-aggregate.input.ts +++ b/src/@generated/user/user-avg-aggregate.input.ts @@ -6,11 +6,11 @@ export class UserAvgAggregateInput { nullable: true, description: undefined, }) - countComments?: true | null; + countComments?: true; @Field(() => Boolean, { nullable: true, description: undefined, }) - rating?: true | null; + rating?: true; } diff --git a/src/@generated/user/user-avg-aggregate.output.ts b/src/@generated/user/user-avg-aggregate.output.ts index 620a90ca..b796463b 100644 --- a/src/@generated/user/user-avg-aggregate.output.ts +++ b/src/@generated/user/user-avg-aggregate.output.ts @@ -6,11 +6,11 @@ export class UserAvgAggregate { nullable: true, description: undefined, }) - countComments?: number | null; + countComments?: number; @Field(() => Float, { nullable: true, description: undefined, }) - rating?: number | null; + rating?: number; } diff --git a/src/@generated/user/user-create-many-without-favorite-articles.input.ts b/src/@generated/user/user-create-many-without-favorite-articles.input.ts index ce345dc0..1eae0281 100644 --- a/src/@generated/user/user-create-many-without-favorite-articles.input.ts +++ b/src/@generated/user/user-create-many-without-favorite-articles.input.ts @@ -9,11 +9,11 @@ export class UserCreateManyWithoutFavoriteArticlesInput { nullable: true, description: undefined, }) - create?: Array; + create?: UserCreateWithoutFavoriteArticlesInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: UserWhereUniqueInput | Array; } diff --git a/src/@generated/user/user-create-many-without-followers.input.ts b/src/@generated/user/user-create-many-without-followers.input.ts index 9ad460b1..d2824327 100644 --- a/src/@generated/user/user-create-many-without-followers.input.ts +++ b/src/@generated/user/user-create-many-without-followers.input.ts @@ -9,11 +9,11 @@ export class UserCreateManyWithoutFollowersInput { nullable: true, description: undefined, }) - create?: Array; + create?: UserCreateWithoutFollowersInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: UserWhereUniqueInput | Array; } diff --git a/src/@generated/user/user-create-many-without-following.input.ts b/src/@generated/user/user-create-many-without-following.input.ts index ed221a14..0126643a 100644 --- a/src/@generated/user/user-create-many-without-following.input.ts +++ b/src/@generated/user/user-create-many-without-following.input.ts @@ -9,11 +9,11 @@ export class UserCreateManyWithoutFollowingInput { nullable: true, description: undefined, }) - create?: Array; + create?: UserCreateWithoutFollowingInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: UserWhereUniqueInput | Array; } diff --git a/src/@generated/user/user-create-without-articles.input.ts b/src/@generated/user/user-create-without-articles.input.ts index 21c3adb6..c430d413 100644 --- a/src/@generated/user/user-create-without-articles.input.ts +++ b/src/@generated/user/user-create-without-articles.input.ts @@ -59,23 +59,23 @@ export class UserCreateWithoutArticlesInput { nullable: true, description: undefined, }) - following?: UserCreateManyWithoutFollowersInput | null; + following?: UserCreateManyWithoutFollowersInput; @Field(() => UserCreateManyWithoutFollowingInput, { nullable: true, description: undefined, }) - followers?: UserCreateManyWithoutFollowingInput | null; + followers?: UserCreateManyWithoutFollowingInput; @Field(() => ArticleCreateManyWithoutFavoritedByInput, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleCreateManyWithoutFavoritedByInput | null; + favoriteArticles?: ArticleCreateManyWithoutFavoritedByInput; @Field(() => CommentCreateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - comments?: CommentCreateManyWithoutAuthorInput | null; + comments?: CommentCreateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-create-without-comments.input.ts b/src/@generated/user/user-create-without-comments.input.ts index 08874751..9e67840b 100644 --- a/src/@generated/user/user-create-without-comments.input.ts +++ b/src/@generated/user/user-create-without-comments.input.ts @@ -59,23 +59,23 @@ export class UserCreateWithoutCommentsInput { nullable: true, description: undefined, }) - following?: UserCreateManyWithoutFollowersInput | null; + following?: UserCreateManyWithoutFollowersInput; @Field(() => UserCreateManyWithoutFollowingInput, { nullable: true, description: undefined, }) - followers?: UserCreateManyWithoutFollowingInput | null; + followers?: UserCreateManyWithoutFollowingInput; @Field(() => ArticleCreateManyWithoutFavoritedByInput, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleCreateManyWithoutFavoritedByInput | null; + favoriteArticles?: ArticleCreateManyWithoutFavoritedByInput; @Field(() => ArticleCreateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - articles?: ArticleCreateManyWithoutAuthorInput | null; + articles?: ArticleCreateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-create-without-favorite-articles.input.ts b/src/@generated/user/user-create-without-favorite-articles.input.ts index f32dfbcb..0884a138 100644 --- a/src/@generated/user/user-create-without-favorite-articles.input.ts +++ b/src/@generated/user/user-create-without-favorite-articles.input.ts @@ -59,23 +59,23 @@ export class UserCreateWithoutFavoriteArticlesInput { nullable: true, description: undefined, }) - following?: UserCreateManyWithoutFollowersInput | null; + following?: UserCreateManyWithoutFollowersInput; @Field(() => UserCreateManyWithoutFollowingInput, { nullable: true, description: undefined, }) - followers?: UserCreateManyWithoutFollowingInput | null; + followers?: UserCreateManyWithoutFollowingInput; @Field(() => ArticleCreateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - articles?: ArticleCreateManyWithoutAuthorInput | null; + articles?: ArticleCreateManyWithoutAuthorInput; @Field(() => CommentCreateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - comments?: CommentCreateManyWithoutAuthorInput | null; + comments?: CommentCreateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-create-without-followers.input.ts b/src/@generated/user/user-create-without-followers.input.ts index aca9822d..bba98e1f 100644 --- a/src/@generated/user/user-create-without-followers.input.ts +++ b/src/@generated/user/user-create-without-followers.input.ts @@ -59,23 +59,23 @@ export class UserCreateWithoutFollowersInput { nullable: true, description: undefined, }) - following?: UserCreateManyWithoutFollowersInput | null; + following?: UserCreateManyWithoutFollowersInput; @Field(() => ArticleCreateManyWithoutFavoritedByInput, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleCreateManyWithoutFavoritedByInput | null; + favoriteArticles?: ArticleCreateManyWithoutFavoritedByInput; @Field(() => ArticleCreateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - articles?: ArticleCreateManyWithoutAuthorInput | null; + articles?: ArticleCreateManyWithoutAuthorInput; @Field(() => CommentCreateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - comments?: CommentCreateManyWithoutAuthorInput | null; + comments?: CommentCreateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-create-without-following.input.ts b/src/@generated/user/user-create-without-following.input.ts index ab146d88..9f85f515 100644 --- a/src/@generated/user/user-create-without-following.input.ts +++ b/src/@generated/user/user-create-without-following.input.ts @@ -59,23 +59,23 @@ export class UserCreateWithoutFollowingInput { nullable: true, description: undefined, }) - followers?: UserCreateManyWithoutFollowingInput | null; + followers?: UserCreateManyWithoutFollowingInput; @Field(() => ArticleCreateManyWithoutFavoritedByInput, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleCreateManyWithoutFavoritedByInput | null; + favoriteArticles?: ArticleCreateManyWithoutFavoritedByInput; @Field(() => ArticleCreateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - articles?: ArticleCreateManyWithoutAuthorInput | null; + articles?: ArticleCreateManyWithoutAuthorInput; @Field(() => CommentCreateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - comments?: CommentCreateManyWithoutAuthorInput | null; + comments?: CommentCreateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-create.input.ts b/src/@generated/user/user-create.input.ts index b954f2fd..834685d5 100644 --- a/src/@generated/user/user-create.input.ts +++ b/src/@generated/user/user-create.input.ts @@ -60,29 +60,29 @@ export class UserCreateInput { nullable: true, description: undefined, }) - following?: UserCreateManyWithoutFollowersInput | null; + following?: UserCreateManyWithoutFollowersInput; @Field(() => UserCreateManyWithoutFollowingInput, { nullable: true, description: undefined, }) - followers?: UserCreateManyWithoutFollowingInput | null; + followers?: UserCreateManyWithoutFollowingInput; @Field(() => ArticleCreateManyWithoutFavoritedByInput, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleCreateManyWithoutFavoritedByInput | null; + favoriteArticles?: ArticleCreateManyWithoutFavoritedByInput; @Field(() => ArticleCreateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - articles?: ArticleCreateManyWithoutAuthorInput | null; + articles?: ArticleCreateManyWithoutAuthorInput; @Field(() => CommentCreateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - comments?: CommentCreateManyWithoutAuthorInput | null; + comments?: CommentCreateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-max-aggregate.input.ts b/src/@generated/user/user-max-aggregate.input.ts index cedaf0c5..45ef06ce 100644 --- a/src/@generated/user/user-max-aggregate.input.ts +++ b/src/@generated/user/user-max-aggregate.input.ts @@ -6,11 +6,11 @@ export class UserMaxAggregateInput { nullable: true, description: undefined, }) - countComments?: true | null; + countComments?: true; @Field(() => Boolean, { nullable: true, description: undefined, }) - rating?: true | null; + rating?: true; } diff --git a/src/@generated/user/user-max-aggregate.output.ts b/src/@generated/user/user-max-aggregate.output.ts index 09757a10..9a2a4cc8 100644 --- a/src/@generated/user/user-max-aggregate.output.ts +++ b/src/@generated/user/user-max-aggregate.output.ts @@ -6,11 +6,11 @@ export class UserMaxAggregate { nullable: true, description: undefined, }) - countComments?: number | null; + countComments?: number; @Field(() => Float, { nullable: true, description: undefined, }) - rating?: number | null; + rating?: number; } diff --git a/src/@generated/user/user-min-aggregate.input.ts b/src/@generated/user/user-min-aggregate.input.ts index 437e7f09..705a1953 100644 --- a/src/@generated/user/user-min-aggregate.input.ts +++ b/src/@generated/user/user-min-aggregate.input.ts @@ -6,11 +6,11 @@ export class UserMinAggregateInput { nullable: true, description: undefined, }) - countComments?: true | null; + countComments?: true; @Field(() => Boolean, { nullable: true, description: undefined, }) - rating?: true | null; + rating?: true; } diff --git a/src/@generated/user/user-min-aggregate.output.ts b/src/@generated/user/user-min-aggregate.output.ts index b2f6b808..22b9cd0b 100644 --- a/src/@generated/user/user-min-aggregate.output.ts +++ b/src/@generated/user/user-min-aggregate.output.ts @@ -6,11 +6,11 @@ export class UserMinAggregate { nullable: true, description: undefined, }) - countComments?: number | null; + countComments?: number; @Field(() => Float, { nullable: true, description: undefined, }) - rating?: number | null; + rating?: number; } diff --git a/src/@generated/user/user-order-by.input.ts b/src/@generated/user/user-order-by.input.ts index 744b70c9..3d7a71fc 100644 --- a/src/@generated/user/user-order-by.input.ts +++ b/src/@generated/user/user-order-by.input.ts @@ -32,23 +32,23 @@ export class UserOrderByInput { nullable: true, description: undefined, }) - bio?: SortOrder | null; + bio?: SortOrder; @Field(() => SortOrder, { nullable: true, description: undefined, }) - image?: SortOrder | null; + image?: SortOrder; @Field(() => SortOrder, { nullable: true, description: undefined, }) - countComments?: SortOrder | null; + countComments?: SortOrder; @Field(() => SortOrder, { nullable: true, description: undefined, }) - rating?: SortOrder | null; + rating?: SortOrder; } diff --git a/src/@generated/user/user-relation-filter.input.ts b/src/@generated/user/user-relation-filter.input.ts index 4de53213..196cbfd4 100644 --- a/src/@generated/user/user-relation-filter.input.ts +++ b/src/@generated/user/user-relation-filter.input.ts @@ -8,11 +8,11 @@ export class UserRelationFilter { nullable: true, description: undefined, }) - is?: UserWhereInput | null; + is?: UserWhereInput; @Field(() => UserWhereInput, { nullable: true, description: undefined, }) - isNot?: UserWhereInput | null; + isNot?: UserWhereInput; } diff --git a/src/@generated/user/user-scalar-where.input.ts b/src/@generated/user/user-scalar-where.input.ts index fa278dd0..41ab91ef 100644 --- a/src/@generated/user/user-scalar-where.input.ts +++ b/src/@generated/user/user-scalar-where.input.ts @@ -16,7 +16,7 @@ export class UserScalarWhereInput { nullable: true, description: undefined, }) - OR?: Array; + OR?: UserScalarWhereInput | Array; @Field(() => [UserScalarWhereInput], { nullable: true, @@ -28,47 +28,47 @@ export class UserScalarWhereInput { nullable: true, description: undefined, }) - id?: string | StringFilter; + id?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - email?: string | StringFilter; + email?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - name?: string | StringFilter; + name?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - password?: string | StringFilter; + password?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - bio?: string | StringFilter | null; + bio?: StringFilter | string | null; @Field(() => StringFilter, { nullable: true, description: undefined, }) - image?: string | StringFilter | null; + image?: StringFilter | string | null; @Field(() => IntFilter, { nullable: true, description: undefined, }) - countComments?: number | IntFilter | null; + countComments?: IntFilter | number | null; @Field(() => FloatFilter, { nullable: true, description: undefined, }) - rating?: number | FloatFilter | null; + rating?: FloatFilter | number | null; } diff --git a/src/@generated/user/user-sum-aggregate.input.ts b/src/@generated/user/user-sum-aggregate.input.ts index f06bef34..013a3490 100644 --- a/src/@generated/user/user-sum-aggregate.input.ts +++ b/src/@generated/user/user-sum-aggregate.input.ts @@ -6,11 +6,11 @@ export class UserSumAggregateInput { nullable: true, description: undefined, }) - countComments?: true | null; + countComments?: true; @Field(() => Boolean, { nullable: true, description: undefined, }) - rating?: true | null; + rating?: true; } diff --git a/src/@generated/user/user-sum-aggregate.output.ts b/src/@generated/user/user-sum-aggregate.output.ts index ffe3c133..ff3ecae4 100644 --- a/src/@generated/user/user-sum-aggregate.output.ts +++ b/src/@generated/user/user-sum-aggregate.output.ts @@ -6,11 +6,11 @@ export class UserSumAggregate { nullable: true, description: undefined, }) - countComments?: number | null; + countComments?: number; @Field(() => Float, { nullable: true, description: undefined, }) - rating?: number | null; + rating?: number; } diff --git a/src/@generated/user/user-update-many-without-favorite-articles.input.ts b/src/@generated/user/user-update-many-without-favorite-articles.input.ts index fd07ba20..9c2278ce 100644 --- a/src/@generated/user/user-update-many-without-favorite-articles.input.ts +++ b/src/@generated/user/user-update-many-without-favorite-articles.input.ts @@ -13,53 +13,57 @@ export class UserUpdateManyWithoutFavoriteArticlesInput { nullable: true, description: undefined, }) - create?: Array; + create?: UserCreateWithoutFavoriteArticlesInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: UserWhereUniqueInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - set?: Array; + set?: UserWhereUniqueInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - disconnect?: Array; + disconnect?: UserWhereUniqueInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - delete?: Array; + delete?: UserWhereUniqueInput | Array; @Field(() => [UserUpdateWithWhereUniqueWithoutFavoriteArticlesInput], { nullable: true, description: undefined, }) - update?: Array; + update?: + | UserUpdateWithWhereUniqueWithoutFavoriteArticlesInput + | Array; @Field(() => [UserUpdateManyWithWhereNestedInput], { nullable: true, description: undefined, }) - updateMany?: Array | null; + updateMany?: UserUpdateManyWithWhereNestedInput | Array; @Field(() => [UserScalarWhereInput], { nullable: true, description: undefined, }) - deleteMany?: Array; + deleteMany?: UserScalarWhereInput | Array; @Field(() => [UserUpsertWithWhereUniqueWithoutFavoriteArticlesInput], { nullable: true, description: undefined, }) - upsert?: Array; + upsert?: + | UserUpsertWithWhereUniqueWithoutFavoriteArticlesInput + | Array; } diff --git a/src/@generated/user/user-update-many-without-followers.input.ts b/src/@generated/user/user-update-many-without-followers.input.ts index 9826f866..7b1e7133 100644 --- a/src/@generated/user/user-update-many-without-followers.input.ts +++ b/src/@generated/user/user-update-many-without-followers.input.ts @@ -13,53 +13,57 @@ export class UserUpdateManyWithoutFollowersInput { nullable: true, description: undefined, }) - create?: Array; + create?: UserCreateWithoutFollowersInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: UserWhereUniqueInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - set?: Array; + set?: UserWhereUniqueInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - disconnect?: Array; + disconnect?: UserWhereUniqueInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - delete?: Array; + delete?: UserWhereUniqueInput | Array; @Field(() => [UserUpdateWithWhereUniqueWithoutFollowersInput], { nullable: true, description: undefined, }) - update?: Array; + update?: + | UserUpdateWithWhereUniqueWithoutFollowersInput + | Array; @Field(() => [UserUpdateManyWithWhereNestedInput], { nullable: true, description: undefined, }) - updateMany?: Array | null; + updateMany?: UserUpdateManyWithWhereNestedInput | Array; @Field(() => [UserScalarWhereInput], { nullable: true, description: undefined, }) - deleteMany?: Array; + deleteMany?: UserScalarWhereInput | Array; @Field(() => [UserUpsertWithWhereUniqueWithoutFollowersInput], { nullable: true, description: undefined, }) - upsert?: Array; + upsert?: + | UserUpsertWithWhereUniqueWithoutFollowersInput + | Array; } diff --git a/src/@generated/user/user-update-many-without-following.input.ts b/src/@generated/user/user-update-many-without-following.input.ts index ae7f6ae9..77a24438 100644 --- a/src/@generated/user/user-update-many-without-following.input.ts +++ b/src/@generated/user/user-update-many-without-following.input.ts @@ -13,53 +13,57 @@ export class UserUpdateManyWithoutFollowingInput { nullable: true, description: undefined, }) - create?: Array; + create?: UserCreateWithoutFollowingInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - connect?: Array; + connect?: UserWhereUniqueInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - set?: Array; + set?: UserWhereUniqueInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - disconnect?: Array; + disconnect?: UserWhereUniqueInput | Array; @Field(() => [UserWhereUniqueInput], { nullable: true, description: undefined, }) - delete?: Array; + delete?: UserWhereUniqueInput | Array; @Field(() => [UserUpdateWithWhereUniqueWithoutFollowingInput], { nullable: true, description: undefined, }) - update?: Array; + update?: + | UserUpdateWithWhereUniqueWithoutFollowingInput + | Array; @Field(() => [UserUpdateManyWithWhereNestedInput], { nullable: true, description: undefined, }) - updateMany?: Array | null; + updateMany?: UserUpdateManyWithWhereNestedInput | Array; @Field(() => [UserScalarWhereInput], { nullable: true, description: undefined, }) - deleteMany?: Array; + deleteMany?: UserScalarWhereInput | Array; @Field(() => [UserUpsertWithWhereUniqueWithoutFollowingInput], { nullable: true, description: undefined, }) - upsert?: Array; + upsert?: + | UserUpsertWithWhereUniqueWithoutFollowingInput + | Array; } diff --git a/src/@generated/user/user-update-without-articles-data.input.ts b/src/@generated/user/user-update-without-articles-data.input.ts index 9c90b817..8a7c190d 100644 --- a/src/@generated/user/user-update-without-articles-data.input.ts +++ b/src/@generated/user/user-update-without-articles-data.input.ts @@ -59,23 +59,23 @@ export class UserUpdateWithoutArticlesDataInput { nullable: true, description: undefined, }) - following?: UserUpdateManyWithoutFollowersInput | null; + following?: UserUpdateManyWithoutFollowersInput; @Field(() => UserUpdateManyWithoutFollowingInput, { nullable: true, description: undefined, }) - followers?: UserUpdateManyWithoutFollowingInput | null; + followers?: UserUpdateManyWithoutFollowingInput; @Field(() => ArticleUpdateManyWithoutFavoritedByInput, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleUpdateManyWithoutFavoritedByInput | null; + favoriteArticles?: ArticleUpdateManyWithoutFavoritedByInput; @Field(() => CommentUpdateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - comments?: CommentUpdateManyWithoutAuthorInput | null; + comments?: CommentUpdateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-update-without-comments-data.input.ts b/src/@generated/user/user-update-without-comments-data.input.ts index 575e3b48..64232dcf 100644 --- a/src/@generated/user/user-update-without-comments-data.input.ts +++ b/src/@generated/user/user-update-without-comments-data.input.ts @@ -59,23 +59,23 @@ export class UserUpdateWithoutCommentsDataInput { nullable: true, description: undefined, }) - following?: UserUpdateManyWithoutFollowersInput | null; + following?: UserUpdateManyWithoutFollowersInput; @Field(() => UserUpdateManyWithoutFollowingInput, { nullable: true, description: undefined, }) - followers?: UserUpdateManyWithoutFollowingInput | null; + followers?: UserUpdateManyWithoutFollowingInput; @Field(() => ArticleUpdateManyWithoutFavoritedByInput, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleUpdateManyWithoutFavoritedByInput | null; + favoriteArticles?: ArticleUpdateManyWithoutFavoritedByInput; @Field(() => ArticleUpdateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - articles?: ArticleUpdateManyWithoutAuthorInput | null; + articles?: ArticleUpdateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-update-without-favorite-articles-data.input.ts b/src/@generated/user/user-update-without-favorite-articles-data.input.ts index 6b4c1f9e..0ac4abd2 100644 --- a/src/@generated/user/user-update-without-favorite-articles-data.input.ts +++ b/src/@generated/user/user-update-without-favorite-articles-data.input.ts @@ -59,23 +59,23 @@ export class UserUpdateWithoutFavoriteArticlesDataInput { nullable: true, description: undefined, }) - following?: UserUpdateManyWithoutFollowersInput | null; + following?: UserUpdateManyWithoutFollowersInput; @Field(() => UserUpdateManyWithoutFollowingInput, { nullable: true, description: undefined, }) - followers?: UserUpdateManyWithoutFollowingInput | null; + followers?: UserUpdateManyWithoutFollowingInput; @Field(() => ArticleUpdateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - articles?: ArticleUpdateManyWithoutAuthorInput | null; + articles?: ArticleUpdateManyWithoutAuthorInput; @Field(() => CommentUpdateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - comments?: CommentUpdateManyWithoutAuthorInput | null; + comments?: CommentUpdateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-update-without-followers-data.input.ts b/src/@generated/user/user-update-without-followers-data.input.ts index fd2f23e2..e0771ffb 100644 --- a/src/@generated/user/user-update-without-followers-data.input.ts +++ b/src/@generated/user/user-update-without-followers-data.input.ts @@ -59,23 +59,23 @@ export class UserUpdateWithoutFollowersDataInput { nullable: true, description: undefined, }) - following?: UserUpdateManyWithoutFollowersInput | null; + following?: UserUpdateManyWithoutFollowersInput; @Field(() => ArticleUpdateManyWithoutFavoritedByInput, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleUpdateManyWithoutFavoritedByInput | null; + favoriteArticles?: ArticleUpdateManyWithoutFavoritedByInput; @Field(() => ArticleUpdateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - articles?: ArticleUpdateManyWithoutAuthorInput | null; + articles?: ArticleUpdateManyWithoutAuthorInput; @Field(() => CommentUpdateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - comments?: CommentUpdateManyWithoutAuthorInput | null; + comments?: CommentUpdateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-update-without-following-data.input.ts b/src/@generated/user/user-update-without-following-data.input.ts index a6898449..5581614a 100644 --- a/src/@generated/user/user-update-without-following-data.input.ts +++ b/src/@generated/user/user-update-without-following-data.input.ts @@ -59,23 +59,23 @@ export class UserUpdateWithoutFollowingDataInput { nullable: true, description: undefined, }) - followers?: UserUpdateManyWithoutFollowingInput | null; + followers?: UserUpdateManyWithoutFollowingInput; @Field(() => ArticleUpdateManyWithoutFavoritedByInput, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleUpdateManyWithoutFavoritedByInput | null; + favoriteArticles?: ArticleUpdateManyWithoutFavoritedByInput; @Field(() => ArticleUpdateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - articles?: ArticleUpdateManyWithoutAuthorInput | null; + articles?: ArticleUpdateManyWithoutAuthorInput; @Field(() => CommentUpdateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - comments?: CommentUpdateManyWithoutAuthorInput | null; + comments?: CommentUpdateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-update.input.ts b/src/@generated/user/user-update.input.ts index b0f65481..d5dd5640 100644 --- a/src/@generated/user/user-update.input.ts +++ b/src/@generated/user/user-update.input.ts @@ -60,29 +60,29 @@ export class UserUpdateInput { nullable: true, description: undefined, }) - following?: UserUpdateManyWithoutFollowersInput | null; + following?: UserUpdateManyWithoutFollowersInput; @Field(() => UserUpdateManyWithoutFollowingInput, { nullable: true, description: undefined, }) - followers?: UserUpdateManyWithoutFollowingInput | null; + followers?: UserUpdateManyWithoutFollowingInput; @Field(() => ArticleUpdateManyWithoutFavoritedByInput, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleUpdateManyWithoutFavoritedByInput | null; + favoriteArticles?: ArticleUpdateManyWithoutFavoritedByInput; @Field(() => ArticleUpdateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - articles?: ArticleUpdateManyWithoutAuthorInput | null; + articles?: ArticleUpdateManyWithoutAuthorInput; @Field(() => CommentUpdateManyWithoutAuthorInput, { nullable: true, description: undefined, }) - comments?: CommentUpdateManyWithoutAuthorInput | null; + comments?: CommentUpdateManyWithoutAuthorInput; } diff --git a/src/@generated/user/user-where.input.ts b/src/@generated/user/user-where.input.ts index c294007b..7d2e9a42 100644 --- a/src/@generated/user/user-where.input.ts +++ b/src/@generated/user/user-where.input.ts @@ -19,7 +19,7 @@ export class UserWhereInput { nullable: true, description: undefined, }) - OR?: Array; + OR?: UserWhereInput | Array; @Field(() => [UserWhereInput], { nullable: true, @@ -31,77 +31,77 @@ export class UserWhereInput { nullable: true, description: undefined, }) - id?: string | StringFilter; + id?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - email?: string | StringFilter; + email?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - name?: string | StringFilter; + name?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - password?: string | StringFilter; + password?: StringFilter | string; @Field(() => StringFilter, { nullable: true, description: undefined, }) - bio?: string | StringFilter | null; + bio?: StringFilter | string | null; @Field(() => StringFilter, { nullable: true, description: undefined, }) - image?: string | StringFilter | null; + image?: StringFilter | string | null; @Field(() => UserListRelationFilter, { nullable: true, description: undefined, }) - following?: UserListRelationFilter | null; + following?: UserListRelationFilter; @Field(() => UserListRelationFilter, { nullable: true, description: undefined, }) - followers?: UserListRelationFilter | null; + followers?: UserListRelationFilter; @Field(() => ArticleListRelationFilter, { nullable: true, description: undefined, }) - favoriteArticles?: ArticleListRelationFilter | null; + favoriteArticles?: ArticleListRelationFilter; @Field(() => ArticleListRelationFilter, { nullable: true, description: undefined, }) - articles?: ArticleListRelationFilter | null; + articles?: ArticleListRelationFilter; @Field(() => CommentListRelationFilter, { nullable: true, description: undefined, }) - comments?: CommentListRelationFilter | null; + comments?: CommentListRelationFilter; @Field(() => IntFilter, { nullable: true, description: undefined, }) - countComments?: number | IntFilter | null; + countComments?: IntFilter | number | null; @Field(() => FloatFilter, { nullable: true, description: undefined, }) - rating?: number | FloatFilter | null; + rating?: FloatFilter | number | null; } diff --git a/src/@generated/user/user.model.ts b/src/@generated/user/user.model.ts index 0b4e651f..a3ad9314 100644 --- a/src/@generated/user/user.model.ts +++ b/src/@generated/user/user.model.ts @@ -35,53 +35,53 @@ export class User { nullable: true, description: undefined, }) - bio?: string | null; + bio?: string; @Field(() => String, { nullable: true, description: undefined, }) - image?: string | null; + image?: string; @Field(() => [User], { nullable: true, description: undefined, }) - following?: User[] | null; + following?: Array; @Field(() => [User], { nullable: true, description: undefined, }) - followers?: User[] | null; + followers?: Array; @Field(() => [Article], { nullable: true, description: undefined, }) - favoriteArticles?: Article[] | null; + favoriteArticles?: Array
; @Field(() => [Article], { nullable: true, description: undefined, }) - articles?: Article[] | null; + articles?: Array
; @Field(() => [Comment], { nullable: true, description: undefined, }) - comments?: Comment[] | null; + comments?: Array; @Field(() => Int, { nullable: true, description: undefined, }) - countComments?: number | null; + countComments?: number; @Field(() => Float, { nullable: true, description: undefined, }) - rating?: number | null; + rating?: number; } diff --git a/src/generate-args.ts b/src/generate-args.ts index 50798104..cc435a8b 100644 --- a/src/generate-args.ts +++ b/src/generate-args.ts @@ -18,12 +18,12 @@ export function generateArgs(args: GenerateArgsArguments) { // Aggregate args inputType.fields.push({ name: 'count', - inputType: [ + isRequired: false, + isNullable: true, + inputTypes: [ { kind: 'scalar', type: 'true', - isRequired: false, - isNullable: true, isList: false, }, ], @@ -37,12 +37,12 @@ export function generateArgs(args: GenerateArgsArguments) { } inputType.fields.push({ name: name.toLowerCase(), - inputType: [ + isRequired: false, + isNullable: true, + inputTypes: [ { kind: 'object', type: aggregateInput.name, - isRequired: false, - isNullable: true, isList: false, }, ], diff --git a/src/generate-input/generate-input.spec.ts b/src/generate-input/generate-input.spec.ts index c4a45d5b..84cd3278 100644 --- a/src/generate-input/generate-input.spec.ts +++ b/src/generate-input/generate-input.spec.ts @@ -27,7 +27,6 @@ describe('generate inputs', () => { schema: { inputTypes }, }, } = await generatorOptions(schema, { outputFilePattern }); - // console.log('inputTypes', inputTypes); const inputType = inputTypes.find((x) => x.name === name); assert(inputType, `Failed to find ${name}`); sourceFile = project.createSourceFile('0.ts', sourceFileText); @@ -65,7 +64,7 @@ describe('generate inputs', () => { sourceFile.getClass('UserWhereInput')?.getProperty(n)?.getStructure(); assert.strictEqual( struct('id')?.type, - 'string | StringFilter', + 'StringFilter | string', 'id is not nullable in model', ); const decoratorArguments = sourceFile @@ -75,12 +74,7 @@ describe('generate inputs', () => { ?.getCallExpression() ?.getArguments(); assert.strictEqual(decoratorArguments?.[0]?.getText(), '() => StringFilter'); - assert.strictEqual( - struct('OR')?.type, - 'Array', - 'OR property should be array only', - ); - assert.strictEqual(struct('birth')?.type, 'Date | string | DateTimeFilter'); + assert.strictEqual(struct('birth')?.type, 'DateTimeFilter | Date | string'); }); it('user where int filter', async () => { @@ -96,7 +90,7 @@ describe('generate inputs', () => { }); const structure = sourceFile.getClass('UserWhereInput')?.getProperty('age')?.getStructure(); assert(structure); - assert.strictEqual(structure.type, 'number | IntFilter', 'Age property is not nullable'); + assert.strictEqual(structure.type, 'IntFilter | number', 'Age property is not nullable'); const decoratorArguments = sourceFile .getClass('UserWhereInput') @@ -133,8 +127,8 @@ describe('generate inputs', () => { assert.strictEqual(structure('startsWith')?.type, 'string'); assert.strictEqual(structure('endsWith')?.type, 'string'); - assert.strictEqual(structure('in')?.type, 'string | Array'); - assert.strictEqual(structure('notIn')?.type, 'string | Array'); + assert.strictEqual(structure('in')?.type, 'Array'); + assert.strictEqual(structure('notIn')?.type, 'Array'); }); it('user create input', async () => { @@ -218,4 +212,29 @@ describe('generate inputs', () => { assert.strictEqual(struct('some')?.type, 'UserWhereInput'); assert.strictEqual(struct('none')?.type, 'UserWhereInput'); }); + + it('relation filter property', async () => { + await getResult({ + schema: ` + model User { + id Int @id + posts Post[] + } + model Post { + id Int @id + author User @relation(fields: [authorId], references: [id]) + authorId Int + }`, + name: 'PostWhereInput', + model: 'Post', + }); + sourceText = sourceFile.getText(); + const property = sourceFile.getClass('PostWhereInput')?.getProperty('author'); + assert(property, 'Property author should exists'); + assert.strictEqual(property.getStructure().type, 'UserRelationFilter | UserWhereInput'); + assert( + imports.find((x) => x.name === 'UserRelationFilter'), + 'UserRelationFilter import should exists', + ); + }); }); diff --git a/src/generate-input/generate-input.ts b/src/generate-input/generate-input.ts index ddb0473e..b3b9bcb8 100644 --- a/src/generate-input/generate-input.ts +++ b/src/generate-input/generate-input.ts @@ -6,6 +6,7 @@ import { generateGraphqlImport } from '../generate-graphql-import'; import { generateProjectImport } from '../generate-project-import'; import { toGraphqlImportType, toPropertyType } from '../type-utils'; import { PrismaDMMF } from '../types'; +import { getMatchingInputType } from './get-matching-input-type'; type GenerateInputArgs = { inputType: PrismaDMMF.InputType; @@ -25,11 +26,22 @@ export function generateInput(args: GenerateInputArgs) { }); generateGraphqlImport({ name: 'Field', sourceFile, moduleSpecifier: '@nestjs/graphql' }); for (const field of inputType.fields) { - const inputType = getMatchingInputType(field.inputType); const modelField = model?.fields.find((f) => f.name === field.name); + const inputType = getMatchingInputType(field.inputTypes); const nullable = - modelField?.isRequired !== undefined ? !modelField.isRequired : inputType.isNullable; - const propertyType = getPropertyType({ field, nullable }); + modelField?.isRequired !== undefined ? !modelField.isRequired : field.isNullable; + const propertyType = getPropertyType(field.inputTypes); + // Additional import all objects + for (const inputType of field.inputTypes + .filter((x) => x.kind === 'object') + .filter((x) => x.type !== className)) { + generateProjectImport({ + name: String(inputType.type), + type: 'input', + sourceFile, + projectFilePath, + }); + } generateInputProperty({ inputType, propertyType, @@ -96,52 +108,19 @@ function generateInputProperty(args: GenerateInputPropertyArgs) { }); } -type GetPropertyTypeArgs = { - field: PrismaDMMF.SchemaArg; - nullable: boolean; -}; - -function getPropertyType(args: GetPropertyTypeArgs): string { - const { field, nullable } = args; - const inputTypes = field.inputType; - let result = inputTypes - .map((inputType) => { - const type = getTypeName(inputType); - return toPropertyType({ kind: inputType.kind, type }); - }) - .join(' | '); - if (inputTypes.every((t) => t.isList)) { - result = ['AND', 'NOT', 'in', 'notIn'].includes(field.name) - ? `${result} | Array<${result}>` - : `Array<${result}>`; - } - if (!inputTypes.find((t) => t.type === 'null') && nullable) { - result = `${result} | null`; - } - return result; -} - -function getMatchingInputType(inputTypes: PrismaDMMF.SchemaArgInputType[]) { - if (inputTypes.length === 1) { - return inputTypes[0]; - } - const inputType = inputTypes.find((x) => x.kind === 'object'); - if (inputType) { - return inputType; - } - if (inputTypes.every((t) => t.kind === 'scalar')) { - const [result] = inputTypes.filter((t) => t.type !== 'null').slice(-1); - return result; - } - // console.log('inputTypes', inputTypes); - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - throw new TypeError(`Cannot get matching input type from ${inputTypes.map((x) => x.type)}`); +function getPropertyType(inputTypes: PrismaDMMF.SchemaArgInputType[]): string { + let types: string[] = inputTypes.map((inputType) => { + return toPropertyType({ ...inputType, type: String(inputType.type) }); + }); + types = types.sort((a, b) => { + if (b === 'null') { + return -2; + } + return 0; + }); + return types.join(' | '); } function getFieldType(inputType: PrismaDMMF.SchemaArgInputType) { return String(inputType.type); } - -function getTypeName(inputType: PrismaDMMF.SchemaArgInputType) { - return typeof inputType.type === 'string' ? inputType.type : 'unknown'; -} diff --git a/src/generate-input/get-matching-input-type.spec.ts b/src/generate-input/get-matching-input-type.spec.ts new file mode 100644 index 00000000..d527778a --- /dev/null +++ b/src/generate-input/get-matching-input-type.spec.ts @@ -0,0 +1,54 @@ +import assert from 'assert'; + +import { PrismaDMMF } from '../types'; +import { getMatchingInputType } from './get-matching-input-type'; + +describe('get matching input type', () => { + let inputTypes: PrismaDMMF.SchemaArgInputType[] = []; + it('mixed types', () => { + inputTypes = [ + { type: 'StringFilter', kind: 'object', isList: false }, + { type: 'String', kind: 'scalar', isList: false }, + ]; + const result = getMatchingInputType(inputTypes); + assert.deepStrictEqual(result.type, 'StringFilter'); + }); + + it('several kind objects xor list', () => { + inputTypes = [ + { type: 'UserWhereInput', kind: 'object', isList: false }, + { type: 'UserWhereInput', kind: 'object', isList: true }, + ]; + const result = getMatchingInputType(inputTypes); + assert.deepStrictEqual(result, { type: 'UserWhereInput', kind: 'object', isList: true }); + }); + + it('whereinput over relationfilter', () => { + inputTypes = [ + { type: 'UserRelationFilter', kind: 'object', isList: false }, + { type: 'UserWhereInput', kind: 'object', isList: false }, + ]; + const result = getMatchingInputType(inputTypes); + assert.deepStrictEqual(result.type, 'UserWhereInput'); + }); + + it('mixed objects with null', () => { + inputTypes = [ + { type: 'UserRelationFilter', kind: 'object', isList: false }, + { type: 'UserWhereInput', kind: 'object', isList: false }, + { type: 'Null', kind: 'scalar', isList: false }, + ]; + const result = getMatchingInputType(inputTypes); + assert.deepStrictEqual(result.type, 'UserWhereInput'); + }); + + it('mixed with null', () => { + inputTypes = [ + { type: 'IntFilter', kind: 'object', isList: false }, + { type: 'Int', kind: 'scalar', isList: false }, + { type: 'Null', kind: 'scalar', isList: false }, + ]; + const result = getMatchingInputType(inputTypes); + assert.deepStrictEqual(result.type, 'IntFilter'); + }); +}); diff --git a/src/generate-input/get-matching-input-type.ts b/src/generate-input/get-matching-input-type.ts new file mode 100644 index 00000000..7bc24754 --- /dev/null +++ b/src/generate-input/get-matching-input-type.ts @@ -0,0 +1,27 @@ +import { PrismaDMMF } from '../types'; + +/** + * Find input type for graphql field decorator. + */ +export function getMatchingInputType(inputTypes: PrismaDMMF.SchemaArgInputType[]) { + if (inputTypes.length === 1) { + return inputTypes[0]; + } + inputTypes = inputTypes.filter((t) => !['null', 'Null'].includes(String(t.type))); + let result = + inputTypes.every((x) => x.kind === 'object') && + (inputTypes.find((x) => x.kind === 'object' && x.isList) || + inputTypes.find((x) => String(x.type).endsWith('WhereInput'))); + if (result) { + return result; + } + if (inputTypes.length === 1) { + return inputTypes[0]; + } + result = inputTypes.find((x) => x.kind === 'object'); + if (result) { + return result; + } + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + throw new TypeError(`Cannot get matching input type from ${inputTypes.map((x) => x.type)}`); +} diff --git a/src/generate-model/generate-model.spec.ts b/src/generate-model/generate-model.spec.ts index 974f104a..8f090260 100644 --- a/src/generate-model/generate-model.spec.ts +++ b/src/generate-model/generate-model.spec.ts @@ -51,7 +51,7 @@ describe('generate models', () => { '@Field(() => String, { nullable: true, description: undefined })', sourceText, ); - stringContains('image?: string | null', sourceText); + stringContains('image?: string', sourceText); }); it('default value', async () => { @@ -184,4 +184,19 @@ describe('generate models', () => { .find((x) => x.getName() === 'GraphQLJSON'); assert(importSpecifier, 'const GraphQLJSON should be imported'); }); + + it('with related', async () => { + await getResult(` + model User { + id Int @id + posts Post[] + } + model Post { + id Int @id + }`); + sourceText = sourceFile.getText(); + const property = sourceFile.getClass('User')?.getProperty('posts'); + assert(property, 'Property posts should exists'); + assert.strictEqual(property.getStructure().type, 'Array'); + }); }); diff --git a/src/generate-property.ts b/src/generate-property.ts index b7544c9d..03236803 100644 --- a/src/generate-property.ts +++ b/src/generate-property.ts @@ -36,8 +36,7 @@ type GeneratePropertyArgs = { */ export function generateProperty(args: GeneratePropertyArgs) { const { field, className, classDeclaration, sourceFile, projectFilePath, classType } = args; - let propertyType = toPropertyType(field); - const nullable = !field.isRequired; + const propertyType = toPropertyType(field); let fieldType = field.type; if (field.isId || field.kind === 'scalar') { fieldType = generateGraphqlImport({ @@ -54,10 +53,6 @@ export function generateProperty(args: GeneratePropertyArgs) { } if (field.isList) { fieldType = `[${fieldType}]`; - propertyType = `${propertyType}[]`; - } - if (nullable) { - propertyType = `${propertyType} | null`; } const propertyDeclaration = generateClassProperty({ ...field, @@ -67,7 +62,7 @@ export function generateProperty(args: GeneratePropertyArgs) { generateDecorator({ fieldType, propertyDeclaration, - nullable, + nullable: !field.isRequired, defaultValue: field.default, description: field.documentation, }); diff --git a/src/generate.spec.ts b/src/generate.spec.ts index 904028ba..084dae1e 100644 --- a/src/generate.spec.ts +++ b/src/generate.spec.ts @@ -1,10 +1,11 @@ import assert from 'assert'; -import { SourceFile } from 'ts-morph'; +import { PropertyDeclaration, SourceFile } from 'ts-morph'; import { generate } from './generate'; import { generatorOptions, stringContains } from './testing'; describe('main generate', () => { + let property: PropertyDeclaration | undefined; let sourceFile: SourceFile | undefined; let sourceFiles: SourceFile[]; let sourceText: string; @@ -73,7 +74,7 @@ describe('main generate', () => { assert(property, 'Property posts should exists'); stringContains(`@Field(() => [Post]`, property.getText()); - stringContains(`posts?: Post[] | null`, property.getText()); + stringContains(`posts?: Array`, property.getText()); sourceFile = sourceFiles.find((s) => s.getFilePath().toLowerCase().endsWith('/post.model.ts'), @@ -83,6 +84,46 @@ describe('main generate', () => { stringContains(`import { User } from '../user/user.model'`, sourceText); }); + it('whereinput should be used in relation filter', async () => { + await getResult({ + schema: ` + model User { + id String @id + articles Article[] @relation("ArticleAuthor") + } + model Article { + id String @id + author User @relation(name: "ArticleAuthor", fields: [authorId], references: [id]) + authorId String + } + `, + }); + sourceFile = sourceFiles.find((s) => + s.getFilePath().toLowerCase().endsWith('/article-where.input.ts'), + )!; + assert(sourceFile, `File do not exists`); + + property = sourceFile.getClass('ArticleWhereInput')?.getProperty('author'); + assert(property, 'Property author should exists'); + + assert.strictEqual( + property.getStructure().decorators?.[0].arguments?.[0], + '() => UserWhereInput', + 'Union type not yet supported, WhereInput should be used as more common', + ); + + const imports = sourceFile.getImportDeclarations().flatMap((d) => + d.getNamedImports().map((i) => ({ + name: i.getName(), + specifier: d.getModuleSpecifierValue(), + })), + ); + assert( + imports.find(({ name }) => name === 'UserWhereInput'), + 'UserWhereInput should be imported', + ); + }); + it('generator option outputFilePattern', async () => { await getResult({ schema: `model User { @@ -264,22 +305,22 @@ describe('main generate', () => { assert.strictEqual(decoratorArguments?.[0], '() => Boolean'); struct = classDeclaration.getProperty('avg')?.getStructure(); - assert.strictEqual(struct?.type, 'UserAvgAggregateInput | null'); + assert.strictEqual(struct?.type, 'UserAvgAggregateInput'); decoratorArguments = struct.decorators?.[0].arguments; assert.strictEqual(decoratorArguments?.[0], '() => UserAvgAggregateInput'); struct = classDeclaration.getProperty('sum')?.getStructure(); - assert.strictEqual(struct?.type, 'UserSumAggregateInput | null'); + assert.strictEqual(struct?.type, 'UserSumAggregateInput'); decoratorArguments = struct.decorators?.[0].arguments; assert.strictEqual(decoratorArguments?.[0], '() => UserSumAggregateInput'); struct = classDeclaration.getProperty('min')?.getStructure(); - assert.strictEqual(struct?.type, 'UserMinAggregateInput | null'); + assert.strictEqual(struct?.type, 'UserMinAggregateInput'); decoratorArguments = struct.decorators?.[0].arguments; assert.strictEqual(decoratorArguments?.[0], '() => UserMinAggregateInput'); struct = classDeclaration.getProperty('max')?.getStructure(); - assert.strictEqual(struct?.type, 'UserMaxAggregateInput | null'); + assert.strictEqual(struct?.type, 'UserMaxAggregateInput'); decoratorArguments = struct.decorators?.[0].arguments; assert.strictEqual(decoratorArguments?.[0], '() => UserMaxAggregateInput'); diff --git a/src/generate.ts b/src/generate.ts index 484d29f3..c491ecba 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -12,7 +12,7 @@ import { generateInput } from './generate-input'; import { generateModel } from './generate-model'; import { generateObject } from './generate-object'; import { mutateFilters } from './mutate-filters'; -import { getOutputTypeName, schemaFieldToArgument, schemaOutputToInput } from './type-utils'; +import { schemaFieldToArgument, schemaOutputToInput } from './type-utils'; import { PrismaDMMF } from './types'; type GenerateArgs = GeneratorOptions & { @@ -112,6 +112,7 @@ export async function generate(args: GenerateArgs) { generateArgs({ model, inputType, feature, aggregateInputs, sourceFile, projectFilePath }); } // Generate output types + const getOutputTypeName = (name: string) => name.replace(/OutputType$/, ''); const outputTypes = prismaClientDmmf.schema.outputTypes.filter( (t) => !['Query', 'Mutation'].includes(t.name) && !models.find((name) => name === t.name), ); diff --git a/src/mutate-filters.ts b/src/mutate-filters.ts index 70b8d155..0b40181c 100644 --- a/src/mutate-filters.ts +++ b/src/mutate-filters.ts @@ -122,7 +122,7 @@ function combineScalarFilters(inputTypes: PrismaDMMF.InputType[], names: string[ function mutateFieldsType(inputType: PrismaDMMF.InputType, names: string[]) { const [main] = names; inputType.fields.forEach((field) => { - field.inputType.forEach((input) => { + field.inputTypes.forEach((input) => { if (names.includes(String(input.type))) { input.type = main; } @@ -138,7 +138,7 @@ function noAtomicNumberOperations(names: string[]) { return false; } inputType.fields = inputType.fields.map((field) => { - field.inputType = field.inputType.filter((inputType) => { + field.inputTypes = field.inputTypes.filter((inputType) => { return !names.includes(String(inputType.type)); }); return field; diff --git a/src/type-utils.ts b/src/type-utils.ts index 70617129..ecceeb79 100644 --- a/src/type-utils.ts +++ b/src/type-utils.ts @@ -34,22 +34,33 @@ const patterns = new Map([ [{ type: (type: string) => type === 'Int', kind: 'scalar' }, () => 'number'], [{ type: (type: string) => type === 'Boolean', kind: 'scalar' }, () => 'boolean'], [{ type: (type: string) => type === 'Json', kind: 'scalar' }, () => 'object'], + [{ type: (type: string) => type === 'Null', kind: 'scalar' }, () => 'null'], [{ type: () => true, kind: 'object' }, (field: { type: string }) => field.type], [{ type: () => true, kind: 'enum' }, (field: { type: string }) => field.type], [{ type: () => true, kind: 'scalar' }, (field: { type: string }) => field.type], ]); +type ToPropertyTypeArgs = { + type: string; + kind: string; + isList: boolean; +}; /** * Returns typescript property type. */ -export function toPropertyType(field: { type: string; kind: string }): string { - for (const [key, result] of patterns.entries()) { - if (key.kind === field.kind && key.type(field.type)) { - return result(field); +export function toPropertyType(args: ToPropertyTypeArgs): string { + const { type, kind, isList } = args; + for (const [key, get] of patterns.entries()) { + if (key.kind === kind && key.type(type)) { + let result = get(args); + if (isList) { + result = `Array<${result}>`; + } + return result; } } - // console.log('field', field); - throw new TypeError(`Cannot get property type from ${field.kind}/${field.type}`); + // console.log('args', args); + throw new TypeError(`Cannot get property type from ${args.kind}/${args.type}`); } /** @@ -58,15 +69,19 @@ export function toPropertyType(field: { type: string; kind: string }): string { export function schemaOutputToInput(outputType: PrismaDMMF.OutputType): PrismaDMMF.InputType { return { name: outputType.name.replace(/OutputType$/, 'Input'), + constraints: { + maxNumFields: null, + minNumFields: null, + }, fields: outputType.fields.map((field) => { return { ...field, + isNullable: false, + isRequired: false, name: field.name, - inputType: [ + inputTypes: [ { isList: false, - isNullable: false, - isRequired: false, kind: 'scalar', type: 'true', }, @@ -76,12 +91,15 @@ export function schemaOutputToInput(outputType: PrismaDMMF.OutputType): PrismaDM }; } -export function getOutputTypeName(name: string) { - return name.replace(/OutputType$/, ''); -} - export function schemaFieldToArgument(field: PrismaDMMF.SchemaField): PrismaDMMF.InputType { let name = field.name; name = name[0].toUpperCase() + name.slice(1) + 'Args'; - return { name, fields: field.args }; + return { + name, + fields: field.args, + constraints: { + maxNumFields: null, + minNumFields: null, + }, + }; }