Skip to content

Commit f1ba6bc

Browse files
committed
fix: Adapt new native types
1 parent 446b3dd commit f1ba6bc

32 files changed

+781
-24
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"class-validator": "^0.12.2",
9090
"commitizen": "^4.2.2",
9191
"cz-customizable": "^6.3.0",
92+
"decimal.js": "^10.2.1",
9293
"eslint": "^7.13.0",
9394
"eslint-import-resolver-node": "^0.3.4",
9495
"eslint-plugin-etc": "^1.1.6",

prisma/schema.prisma

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ datasource database {
55

66
generator client {
77
provider = "prisma-client-js"
8+
previewFeatures = ["nativeTypes"]
89
}
910

1011
generator nestgraphql {
@@ -67,3 +68,11 @@ model Comment {
6768
enum Role {
6869
USER
6970
}
71+
72+
model Dummy {
73+
id String @id
74+
bytes Bytes?
75+
decimal Decimal?
76+
bigInt BigInt?
77+
json Json?
78+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { ArgsType, Field, Int } from '@nestjs/graphql';
2+
3+
import { DummyAvgAggregateInput } from './dummy-avg-aggregate.input';
4+
import { DummyDistinctFieldEnum } from './dummy-distinct-field.enum';
5+
import { DummyMaxAggregateInput } from './dummy-max-aggregate.input';
6+
import { DummyMinAggregateInput } from './dummy-min-aggregate.input';
7+
import { DummyOrderByInput } from './dummy-order-by.input';
8+
import { DummySumAggregateInput } from './dummy-sum-aggregate.input';
9+
import { DummyWhereUniqueInput } from './dummy-where-unique.input';
10+
import { DummyWhereInput } from './dummy-where.input';
11+
12+
@ArgsType()
13+
export class AggregateDummyArgs {
14+
@Field(() => DummyWhereInput, {
15+
nullable: true,
16+
description: undefined,
17+
})
18+
where?: DummyWhereInput;
19+
20+
@Field(() => [DummyOrderByInput], {
21+
nullable: true,
22+
description: undefined,
23+
})
24+
orderBy?: Array<DummyOrderByInput> | DummyOrderByInput;
25+
26+
@Field(() => DummyWhereUniqueInput, {
27+
nullable: true,
28+
description: undefined,
29+
})
30+
cursor?: DummyWhereUniqueInput;
31+
32+
@Field(() => Int, {
33+
nullable: true,
34+
description: undefined,
35+
})
36+
take?: number;
37+
38+
@Field(() => Int, {
39+
nullable: true,
40+
description: undefined,
41+
})
42+
skip?: number;
43+
44+
@Field(() => [DummyDistinctFieldEnum], {
45+
nullable: true,
46+
description: undefined,
47+
})
48+
distinct?: Array<DummyDistinctFieldEnum>;
49+
50+
@Field(() => Boolean, {
51+
nullable: true,
52+
description: undefined,
53+
})
54+
count?: true;
55+
56+
@Field(() => DummyAvgAggregateInput, {
57+
nullable: true,
58+
description: undefined,
59+
})
60+
avg?: DummyAvgAggregateInput;
61+
62+
@Field(() => DummySumAggregateInput, {
63+
nullable: true,
64+
description: undefined,
65+
})
66+
sum?: DummySumAggregateInput;
67+
68+
@Field(() => DummyMinAggregateInput, {
69+
nullable: true,
70+
description: undefined,
71+
})
72+
min?: DummyMinAggregateInput;
73+
74+
@Field(() => DummyMaxAggregateInput, {
75+
nullable: true,
76+
description: undefined,
77+
})
78+
max?: DummyMaxAggregateInput;
79+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Field, Int, ObjectType } from '@nestjs/graphql';
2+
3+
import { DummyAvgAggregate } from './dummy-avg-aggregate.output';
4+
import { DummyMaxAggregate } from './dummy-max-aggregate.output';
5+
import { DummyMinAggregate } from './dummy-min-aggregate.output';
6+
import { DummySumAggregate } from './dummy-sum-aggregate.output';
7+
8+
@ObjectType()
9+
export class AggregateDummy {
10+
@Field(() => Int, {
11+
nullable: true,
12+
description: undefined,
13+
})
14+
count?: number;
15+
16+
@Field(() => DummyAvgAggregate, {
17+
nullable: true,
18+
description: undefined,
19+
})
20+
avg?: DummyAvgAggregate;
21+
22+
@Field(() => DummySumAggregate, {
23+
nullable: true,
24+
description: undefined,
25+
})
26+
sum?: DummySumAggregate;
27+
28+
@Field(() => DummyMinAggregate, {
29+
nullable: true,
30+
description: undefined,
31+
})
32+
min?: DummyMinAggregate;
33+
34+
@Field(() => DummyMaxAggregate, {
35+
nullable: true,
36+
description: undefined,
37+
})
38+
max?: DummyMaxAggregate;
39+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Field, InputType } from '@nestjs/graphql';
2+
3+
@InputType()
4+
export class DummyAvgAggregateInput {
5+
@Field(() => Boolean, {
6+
nullable: true,
7+
description: undefined,
8+
})
9+
decimal?: true;
10+
11+
@Field(() => Boolean, {
12+
nullable: true,
13+
description: undefined,
14+
})
15+
bigInt?: true;
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Field, Float, ObjectType } from '@nestjs/graphql';
2+
3+
@ObjectType()
4+
export class DummyAvgAggregate {
5+
@Field(() => String, {
6+
nullable: true,
7+
description: undefined,
8+
})
9+
decimal?: string;
10+
11+
@Field(() => Float, {
12+
nullable: true,
13+
description: undefined,
14+
})
15+
bigInt?: number;
16+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Field, InputType } from '@nestjs/graphql';
2+
import { GraphQLJSON } from 'graphql-type-json';
3+
4+
@InputType()
5+
export class DummyCreateInput {
6+
@Field(() => String, {
7+
nullable: true,
8+
description: undefined,
9+
})
10+
id?: string;
11+
12+
@Field(() => String, {
13+
nullable: true,
14+
description: undefined,
15+
})
16+
bytes?: Buffer | null;
17+
18+
@Field(() => String, {
19+
nullable: true,
20+
description: undefined,
21+
})
22+
decimal?: string | null;
23+
24+
@Field(() => String, {
25+
nullable: true,
26+
description: undefined,
27+
})
28+
bigInt?: BigInt | null;
29+
30+
@Field(() => GraphQLJSON, {
31+
nullable: true,
32+
description: undefined,
33+
})
34+
json?: object | null;
35+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { registerEnumType } from '@nestjs/graphql';
2+
3+
export enum DummyDistinctFieldEnum {
4+
id = 'id',
5+
bytes = 'bytes',
6+
decimal = 'decimal',
7+
bigInt = 'bigInt',
8+
json = 'json',
9+
}
10+
11+
registerEnumType(DummyDistinctFieldEnum, {
12+
name: 'DummyDistinctFieldEnum',
13+
description: undefined,
14+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Field, InputType } from '@nestjs/graphql';
2+
3+
@InputType()
4+
export class DummyMaxAggregateInput {
5+
@Field(() => Boolean, {
6+
nullable: true,
7+
description: undefined,
8+
})
9+
decimal?: true;
10+
11+
@Field(() => Boolean, {
12+
nullable: true,
13+
description: undefined,
14+
})
15+
bigInt?: true;
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Field, ObjectType } from '@nestjs/graphql';
2+
3+
@ObjectType()
4+
export class DummyMaxAggregate {
5+
@Field(() => String, {
6+
nullable: true,
7+
description: undefined,
8+
})
9+
decimal?: string;
10+
11+
@Field(() => String, {
12+
nullable: true,
13+
description: undefined,
14+
})
15+
bigInt?: BigInt;
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Field, InputType } from '@nestjs/graphql';
2+
3+
@InputType()
4+
export class DummyMinAggregateInput {
5+
@Field(() => Boolean, {
6+
nullable: true,
7+
description: undefined,
8+
})
9+
decimal?: true;
10+
11+
@Field(() => Boolean, {
12+
nullable: true,
13+
description: undefined,
14+
})
15+
bigInt?: true;
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Field, ObjectType } from '@nestjs/graphql';
2+
3+
@ObjectType()
4+
export class DummyMinAggregate {
5+
@Field(() => String, {
6+
nullable: true,
7+
description: undefined,
8+
})
9+
decimal?: string;
10+
11+
@Field(() => String, {
12+
nullable: true,
13+
description: undefined,
14+
})
15+
bigInt?: BigInt;
16+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { Field, InputType } from '@nestjs/graphql';
2+
3+
import { SortOrder } from '../prisma/sort-order.enum';
4+
5+
@InputType()
6+
export class DummyOrderByInput {
7+
@Field(() => SortOrder, {
8+
nullable: true,
9+
description: undefined,
10+
})
11+
id?: SortOrder;
12+
13+
@Field(() => SortOrder, {
14+
nullable: true,
15+
description: undefined,
16+
})
17+
bytes?: SortOrder;
18+
19+
@Field(() => SortOrder, {
20+
nullable: true,
21+
description: undefined,
22+
})
23+
decimal?: SortOrder;
24+
25+
@Field(() => SortOrder, {
26+
nullable: true,
27+
description: undefined,
28+
})
29+
bigInt?: SortOrder;
30+
31+
@Field(() => SortOrder, {
32+
nullable: true,
33+
description: undefined,
34+
})
35+
json?: SortOrder;
36+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Field, InputType } from '@nestjs/graphql';
2+
3+
@InputType()
4+
export class DummySumAggregateInput {
5+
@Field(() => Boolean, {
6+
nullable: true,
7+
description: undefined,
8+
})
9+
decimal?: true;
10+
11+
@Field(() => Boolean, {
12+
nullable: true,
13+
description: undefined,
14+
})
15+
bigInt?: true;
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Field, ObjectType } from '@nestjs/graphql';
2+
3+
@ObjectType()
4+
export class DummySumAggregate {
5+
@Field(() => String, {
6+
nullable: true,
7+
description: undefined,
8+
})
9+
decimal?: string;
10+
11+
@Field(() => String, {
12+
nullable: true,
13+
description: undefined,
14+
})
15+
bigInt?: BigInt;
16+
}

0 commit comments

Comments
 (0)