Skip to content

Commit

Permalink
fix: Model types mismatch
Browse files Browse the repository at this point in the history
closes: unlight#21
  • Loading branch information
unlight committed Apr 25, 2021
1 parent 7197d6c commit ffe70b6
Show file tree
Hide file tree
Showing 45 changed files with 402 additions and 246 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"precise-commits": "^1.0.2",
"prettier": "^2.2.1",
"prisma": "2.21.2",
"prisma-graphql-type-decimal": "^1.0.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^6.6.7",
"semantic-release": "^17.4.2",
Expand Down
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ enum Role {

model Dummy {
id String @id
created DateTime @default(now())
floaty Float
int Int?
float Float?
Expand Down
14 changes: 7 additions & 7 deletions src/@generated/article/article.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export class Article {
body!: string;

@Field(() => [Tag], { nullable: true })
tags?: Array<Tag>;
tags!: Array<Tag>;

@Field(() => Date, { nullable: false })
createdAt!: Date | string;
createdAt!: Date;

@Field(() => Date, { nullable: false })
updatedAt!: Date | string;
updatedAt!: Date;

@Field(() => Int, { nullable: false, defaultValue: 0 })
favoritesCount!: number;
Expand All @@ -41,14 +41,14 @@ export class Article {
authorId!: string;

@Field(() => [User], { nullable: true })
favoritedBy?: Array<User>;
favoritedBy!: Array<User>;

@Field(() => [Comment], { nullable: true })
comments?: Array<Comment>;
comments!: Array<Comment>;

@Field(() => Boolean, { nullable: true, defaultValue: true })
active?: boolean;
active!: boolean | null;

@Field(() => ArticleCount, { nullable: true })
_count?: ArticleCount;
_count!: ArticleCount;
}
8 changes: 4 additions & 4 deletions src/@generated/comment/comment.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export class Comment {
id!: string;

@Field(() => Date, { nullable: false })
createdAt!: Date | string;
createdAt!: Date;

@Field(() => Date, { nullable: false })
updatedAt!: Date | string;
updatedAt!: Date;

@Field(() => String, { nullable: false })
body!: string;
Expand All @@ -24,8 +24,8 @@ export class Comment {
authorId!: string;

@Field(() => Article, { nullable: true })
article?: Article;
article!: Article;

@Field(() => String, { nullable: true })
articleId?: string;
articleId!: string | null;
}
5 changes: 3 additions & 2 deletions src/@generated/dummy/dummy-avg-aggregate.output.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Field, Float, ObjectType } from '@nestjs/graphql';
import { GraphQLDecimal } from 'prisma-graphql-type-decimal';

@ObjectType()
export class DummyAvgAggregate {
Expand All @@ -11,8 +12,8 @@ export class DummyAvgAggregate {
@Field(() => Float, { nullable: true })
float?: number;

@Field(() => String, { nullable: true })
decimal?: number | string;
@Field(() => GraphQLDecimal, { nullable: true })
decimal?: any;

@Field(() => Float, { nullable: true })
bigInt?: number;
Expand Down
3 changes: 3 additions & 0 deletions src/@generated/dummy/dummy-count-aggregate.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export class DummyCountAggregateInput {
@Field(() => Boolean, { nullable: true })
id?: true;

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

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

Expand Down
3 changes: 3 additions & 0 deletions src/@generated/dummy/dummy-count-aggregate.output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export class DummyCountAggregate {
@Field(() => Int, { nullable: false })
id!: number;

@Field(() => Int, { nullable: false })
created!: number;

@Field(() => Int, { nullable: false })
floaty!: number;

Expand Down
8 changes: 6 additions & 2 deletions src/@generated/dummy/dummy-create-many.input.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { Field, Float, InputType, Int } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
import { GraphQLDecimal } from 'prisma-graphql-type-decimal';

@InputType()
export class DummyCreateManyInput {
@Field(() => String, { nullable: false })
id!: string;

@Field(() => Date, { nullable: true })
created?: Date | string;

@Field(() => Float, { nullable: false })
floaty!: number;

Expand All @@ -18,8 +22,8 @@ export class DummyCreateManyInput {
@Field(() => String, { nullable: true })
bytes?: Buffer;

@Field(() => String, { nullable: true })
decimal?: number | string;
@Field(() => GraphQLDecimal, { nullable: true })
decimal?: any;

@Field(() => String, { nullable: true })
bigInt?: bigint | number;
Expand Down
8 changes: 6 additions & 2 deletions src/@generated/dummy/dummy-create.input.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { Field, Float, InputType, Int } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
import { GraphQLDecimal } from 'prisma-graphql-type-decimal';

@InputType()
export class DummyCreateInput {
@Field(() => String, { nullable: false })
id!: string;

@Field(() => Date, { nullable: true })
created?: Date | string;

@Field(() => Float, { nullable: false })
floaty!: number;

Expand All @@ -18,8 +22,8 @@ export class DummyCreateInput {
@Field(() => String, { nullable: true })
bytes?: Buffer;

@Field(() => String, { nullable: true })
decimal?: number | string;
@Field(() => GraphQLDecimal, { nullable: true })
decimal?: any;

@Field(() => String, { nullable: true })
bigInt?: bigint | number;
Expand Down
8 changes: 6 additions & 2 deletions src/@generated/dummy/dummy-group-by.output.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Field, Float, Int, ObjectType } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
import { GraphQLDecimal } from 'prisma-graphql-type-decimal';

import { DummyAvgAggregate } from './dummy-avg-aggregate.output';
import { DummyCountAggregate } from './dummy-count-aggregate.output';
Expand All @@ -12,6 +13,9 @@ export class DummyGroupBy {
@Field(() => String, { nullable: false })
id!: string;

@Field(() => Date, { nullable: false })
created!: Date | string;

@Field(() => Float, { nullable: false })
floaty!: number;

Expand All @@ -24,8 +28,8 @@ export class DummyGroupBy {
@Field(() => String, { nullable: true })
bytes?: Buffer;

@Field(() => String, { nullable: true })
decimal?: number | string;
@Field(() => GraphQLDecimal, { nullable: true })
decimal?: any;

@Field(() => String, { nullable: true })
bigInt?: bigint | number;
Expand Down
3 changes: 3 additions & 0 deletions src/@generated/dummy/dummy-max-aggregate.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export class DummyMaxAggregateInput {
@Field(() => Boolean, { nullable: true })
id?: true;

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

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

Expand Down
8 changes: 6 additions & 2 deletions src/@generated/dummy/dummy-max-aggregate.output.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { Field, Float, Int, ObjectType } from '@nestjs/graphql';
import { GraphQLDecimal } from 'prisma-graphql-type-decimal';

@ObjectType()
export class DummyMaxAggregate {
@Field(() => String, { nullable: true })
id?: string;

@Field(() => Date, { nullable: true })
created?: Date | string;

@Field(() => Float, { nullable: true })
floaty?: number;

Expand All @@ -17,8 +21,8 @@ export class DummyMaxAggregate {
@Field(() => String, { nullable: true })
bytes?: Buffer;

@Field(() => String, { nullable: true })
decimal?: number | string;
@Field(() => GraphQLDecimal, { nullable: true })
decimal?: any;

@Field(() => String, { nullable: true })
bigInt?: bigint | number;
Expand Down
3 changes: 3 additions & 0 deletions src/@generated/dummy/dummy-min-aggregate.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export class DummyMinAggregateInput {
@Field(() => Boolean, { nullable: true })
id?: true;

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

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

Expand Down
8 changes: 6 additions & 2 deletions src/@generated/dummy/dummy-min-aggregate.output.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { Field, Float, Int, ObjectType } from '@nestjs/graphql';
import { GraphQLDecimal } from 'prisma-graphql-type-decimal';

@ObjectType()
export class DummyMinAggregate {
@Field(() => String, { nullable: true })
id?: string;

@Field(() => Date, { nullable: true })
created?: Date | string;

@Field(() => Float, { nullable: true })
floaty?: number;

Expand All @@ -17,8 +21,8 @@ export class DummyMinAggregate {
@Field(() => String, { nullable: true })
bytes?: Buffer;

@Field(() => String, { nullable: true })
decimal?: number | string;
@Field(() => GraphQLDecimal, { nullable: true })
decimal?: any;

@Field(() => String, { nullable: true })
bigInt?: bigint | number;
Expand Down
3 changes: 3 additions & 0 deletions src/@generated/dummy/dummy-order-by-with-relation.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export class DummyOrderByWithRelationInput {
@Field(() => SortOrder, { nullable: true })
id?: SortOrder;

@Field(() => SortOrder, { nullable: true })
created?: SortOrder;

@Field(() => SortOrder, { nullable: true })
floaty?: SortOrder;

Expand Down
3 changes: 3 additions & 0 deletions src/@generated/dummy/dummy-order-by.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export class DummyOrderByInput {
@Field(() => SortOrder, { nullable: true })
id?: SortOrder;

@Field(() => SortOrder, { nullable: true })
created?: SortOrder;

@Field(() => SortOrder, { nullable: true })
floaty?: SortOrder;

Expand Down
1 change: 1 addition & 0 deletions src/@generated/dummy/dummy-scalar-field.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { registerEnumType } from '@nestjs/graphql';

export enum DummyScalarFieldEnum {
id = 'id',
created = 'created',
floaty = 'floaty',
int = 'int',
float = 'float',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Field, InputType } from '@nestjs/graphql';

import { BigIntNullableWithAggregatesFilter } from '../prisma/big-int-nullable-with-aggregates-filter.input';
import { BytesNullableWithAggregatesFilter } from '../prisma/bytes-nullable-with-aggregates-filter.input';
import { DateTimeWithAggregatesFilter } from '../prisma/date-time-with-aggregates-filter.input';
import { DecimalNullableWithAggregatesFilter } from '../prisma/decimal-nullable-with-aggregates-filter.input';
import { FloatNullableWithAggregatesFilter } from '../prisma/float-nullable-with-aggregates-filter.input';
import { FloatWithAggregatesFilter } from '../prisma/float-with-aggregates-filter.input';
Expand All @@ -23,6 +24,9 @@ export class DummyScalarWhereWithAggregatesInput {
@Field(() => StringWithAggregatesFilter, { nullable: true })
id?: StringWithAggregatesFilter;

@Field(() => DateTimeWithAggregatesFilter, { nullable: true })
created?: DateTimeWithAggregatesFilter;

@Field(() => FloatWithAggregatesFilter, { nullable: true })
floaty?: FloatWithAggregatesFilter;

Expand Down
5 changes: 3 additions & 2 deletions src/@generated/dummy/dummy-sum-aggregate.output.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Field, Float, Int, ObjectType } from '@nestjs/graphql';
import { GraphQLDecimal } from 'prisma-graphql-type-decimal';

@ObjectType()
export class DummySumAggregate {
Expand All @@ -11,8 +12,8 @@ export class DummySumAggregate {
@Field(() => Float, { nullable: true })
float?: number;

@Field(() => String, { nullable: true })
decimal?: number | string;
@Field(() => GraphQLDecimal, { nullable: true })
decimal?: any;

@Field(() => String, { nullable: true })
bigInt?: bigint | number;
Expand Down
8 changes: 6 additions & 2 deletions src/@generated/dummy/dummy-unchecked-create.input.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { Field, Float, InputType, Int } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
import { GraphQLDecimal } from 'prisma-graphql-type-decimal';

@InputType()
export class DummyUncheckedCreateInput {
@Field(() => String, { nullable: false })
id!: string;

@Field(() => Date, { nullable: true })
created?: Date | string;

@Field(() => Float, { nullable: false })
floaty!: number;

Expand All @@ -18,8 +22,8 @@ export class DummyUncheckedCreateInput {
@Field(() => String, { nullable: true })
bytes?: Buffer;

@Field(() => String, { nullable: true })
decimal?: number | string;
@Field(() => GraphQLDecimal, { nullable: true })
decimal?: any;

@Field(() => String, { nullable: true })
bigInt?: bigint | number;
Expand Down
4 changes: 4 additions & 0 deletions src/@generated/dummy/dummy-unchecked-update-many.input.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Field, InputType } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';

import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-update-operations.input';
import { FloatFieldUpdateOperationsInput } from '../prisma/float-field-update-operations.input';
import { NullableBigIntFieldUpdateOperationsInput } from '../prisma/nullable-big-int-field-update-operations.input';
import { NullableBytesFieldUpdateOperationsInput } from '../prisma/nullable-bytes-field-update-operations.input';
Expand All @@ -14,6 +15,9 @@ export class DummyUncheckedUpdateManyInput {
@Field(() => StringFieldUpdateOperationsInput, { nullable: true })
id?: StringFieldUpdateOperationsInput;

@Field(() => DateTimeFieldUpdateOperationsInput, { nullable: true })
created?: DateTimeFieldUpdateOperationsInput;

@Field(() => FloatFieldUpdateOperationsInput, { nullable: true })
floaty?: FloatFieldUpdateOperationsInput;

Expand Down
4 changes: 4 additions & 0 deletions src/@generated/dummy/dummy-unchecked-update.input.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Field, InputType } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';

import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-update-operations.input';
import { FloatFieldUpdateOperationsInput } from '../prisma/float-field-update-operations.input';
import { NullableBigIntFieldUpdateOperationsInput } from '../prisma/nullable-big-int-field-update-operations.input';
import { NullableBytesFieldUpdateOperationsInput } from '../prisma/nullable-bytes-field-update-operations.input';
Expand All @@ -14,6 +15,9 @@ export class DummyUncheckedUpdateInput {
@Field(() => StringFieldUpdateOperationsInput, { nullable: true })
id?: StringFieldUpdateOperationsInput;

@Field(() => DateTimeFieldUpdateOperationsInput, { nullable: true })
created?: DateTimeFieldUpdateOperationsInput;

@Field(() => FloatFieldUpdateOperationsInput, { nullable: true })
floaty?: FloatFieldUpdateOperationsInput;

Expand Down
Loading

0 comments on commit ffe70b6

Please sign in to comment.