@smartive/graphql-magic 9.1.2 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +2 -10
- package/.github/workflows/release.yml +1 -1
- package/.gqmrc.json +6 -0
- package/CHANGELOG.md +2 -2
- package/README.md +1 -1
- package/dist/bin/gqm.cjs +684 -330
- package/dist/cjs/index.cjs +998 -554
- package/dist/esm/api/execute.js +1 -1
- package/dist/esm/api/execute.js.map +1 -1
- package/dist/esm/client/mutations.d.ts +2 -2
- package/dist/esm/client/mutations.js +5 -4
- package/dist/esm/client/mutations.js.map +1 -1
- package/dist/esm/client/queries.d.ts +12 -17
- package/dist/esm/client/queries.js +30 -50
- package/dist/esm/client/queries.js.map +1 -1
- package/dist/esm/context.d.ts +1 -2
- package/dist/esm/db/generate.d.ts +3 -3
- package/dist/esm/db/generate.js +31 -29
- package/dist/esm/db/generate.js.map +1 -1
- package/dist/esm/migrations/generate.d.ts +3 -4
- package/dist/esm/migrations/generate.js +114 -107
- package/dist/esm/migrations/generate.js.map +1 -1
- package/dist/esm/models/index.d.ts +1 -0
- package/dist/esm/models/index.js +1 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/model-definitions.d.ts +189 -0
- package/dist/esm/models/model-definitions.js +2 -0
- package/dist/esm/models/model-definitions.js.map +1 -0
- package/dist/esm/models/models.d.ts +128 -174
- package/dist/esm/models/models.js +411 -1
- package/dist/esm/models/models.js.map +1 -1
- package/dist/esm/models/mutation-hook.d.ts +2 -2
- package/dist/esm/models/utils.d.ts +35 -497
- package/dist/esm/models/utils.js +21 -144
- package/dist/esm/models/utils.js.map +1 -1
- package/dist/esm/permissions/check.d.ts +3 -3
- package/dist/esm/permissions/check.js +14 -7
- package/dist/esm/permissions/check.js.map +1 -1
- package/dist/esm/permissions/generate.js +6 -6
- package/dist/esm/permissions/generate.js.map +1 -1
- package/dist/esm/resolvers/filters.d.ts +8 -0
- package/dist/esm/resolvers/filters.js +28 -25
- package/dist/esm/resolvers/filters.js.map +1 -1
- package/dist/esm/resolvers/index.d.ts +1 -0
- package/dist/esm/resolvers/index.js +1 -0
- package/dist/esm/resolvers/index.js.map +1 -1
- package/dist/esm/resolvers/mutations.js +85 -21
- package/dist/esm/resolvers/mutations.js.map +1 -1
- package/dist/esm/resolvers/node.d.ts +13 -15
- package/dist/esm/resolvers/node.js +41 -36
- package/dist/esm/resolvers/node.js.map +1 -1
- package/dist/esm/resolvers/resolver.js +19 -49
- package/dist/esm/resolvers/resolver.js.map +1 -1
- package/dist/esm/resolvers/resolvers.d.ts +1 -8
- package/dist/esm/resolvers/resolvers.js +15 -7
- package/dist/esm/resolvers/resolvers.js.map +1 -1
- package/dist/esm/resolvers/selects.d.ts +3 -0
- package/dist/esm/resolvers/selects.js +50 -0
- package/dist/esm/resolvers/selects.js.map +1 -0
- package/dist/esm/resolvers/utils.d.ts +12 -4
- package/dist/esm/resolvers/utils.js +30 -22
- package/dist/esm/resolvers/utils.js.map +1 -1
- package/dist/esm/schema/generate.d.ts +4 -4
- package/dist/esm/schema/generate.js +122 -131
- package/dist/esm/schema/generate.js.map +1 -1
- package/dist/esm/schema/utils.d.ts +1 -1
- package/dist/esm/schema/utils.js +2 -1
- package/dist/esm/schema/utils.js.map +1 -1
- package/knexfile.ts +31 -0
- package/migrations/20230912185644_setup.ts +127 -0
- package/package.json +16 -14
- package/src/api/execute.ts +1 -1
- package/src/bin/gqm/gqm.ts +25 -23
- package/src/bin/gqm/parse-models.ts +5 -5
- package/src/bin/gqm/settings.ts +13 -4
- package/src/bin/gqm/static-eval.ts +5 -0
- package/src/bin/gqm/templates.ts +23 -3
- package/src/client/mutations.ts +11 -5
- package/src/client/queries.ts +43 -80
- package/src/context.ts +1 -2
- package/src/db/generate.ts +41 -41
- package/src/migrations/generate.ts +165 -146
- package/src/models/index.ts +1 -0
- package/src/models/model-definitions.ts +168 -0
- package/src/models/models.ts +510 -166
- package/src/models/mutation-hook.ts +2 -2
- package/src/models/utils.ts +53 -187
- package/src/permissions/check.ts +19 -11
- package/src/permissions/generate.ts +6 -6
- package/src/resolvers/filters.ts +44 -28
- package/src/resolvers/index.ts +1 -0
- package/src/resolvers/mutations.ts +98 -36
- package/src/resolvers/node.ts +79 -51
- package/src/resolvers/resolver.ts +20 -74
- package/src/resolvers/resolvers.ts +18 -7
- package/src/resolvers/selects.ts +77 -0
- package/src/resolvers/utils.ts +41 -25
- package/src/schema/generate.ts +106 -127
- package/src/schema/utils.ts +2 -1
- package/tests/api/__snapshots__/inheritance.spec.ts.snap +83 -0
- package/tests/api/inheritance.spec.ts +130 -0
- package/tests/generated/api/index.ts +1174 -0
- package/tests/generated/client/index.ts +1163 -0
- package/tests/generated/client/mutations.ts +109 -0
- package/tests/generated/db/index.ts +291 -0
- package/tests/generated/db/knex.ts +14 -0
- package/tests/generated/models.json +675 -0
- package/tests/generated/schema.graphql +325 -0
- package/tests/unit/__snapshots__/resolve.spec.ts.snap +23 -0
- package/tests/unit/queries.spec.ts +5 -5
- package/tests/unit/resolve.spec.ts +8 -8
- package/tests/utils/database/knex.ts +5 -13
- package/tests/utils/database/seed.ts +57 -18
- package/tests/utils/models.ts +62 -7
- package/tests/utils/server.ts +5 -5
- package/tsconfig.eslint.json +1 -0
- package/tests/unit/__snapshots__/generate.spec.ts.snap +0 -128
- package/tests/unit/generate.spec.ts +0 -8
- package/tests/utils/database/schema.ts +0 -64
- package/tests/utils/generate-migration.ts +0 -24
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { gql } from "../../../src";
|
|
2
|
+
|
|
3
|
+
export const DELETE_ANOTHER_OBJECT = gql`
|
|
4
|
+
mutation DeleteAnotherObjectMutation($id: ID!) {
|
|
5
|
+
deleteAnotherObject(where: { id: $id })
|
|
6
|
+
}
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
export const RESTORE_ANOTHER_OBJECT = gql`
|
|
10
|
+
mutation RestoreAnotherObjectMutation($id: ID!) {
|
|
11
|
+
restoreAnotherObject(where: { id: $id })
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export const CREATE_SOME_OBJECT = gql`
|
|
16
|
+
mutation CreateSomeObjectMutation($data: CreateSomeObject!) {
|
|
17
|
+
createSomeObject(data: $data) { id }
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const UPDATE_SOME_OBJECT = gql`
|
|
22
|
+
mutation UpdateSomeObjectMutation($id: ID!, $data: UpdateSomeObject!) {
|
|
23
|
+
updateSomeObject(where: { id: $id }, data: $data) { id }
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export const DELETE_SOME_OBJECT = gql`
|
|
28
|
+
mutation DeleteSomeObjectMutation($id: ID!) {
|
|
29
|
+
deleteSomeObject(where: { id: $id })
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export const RESTORE_SOME_OBJECT = gql`
|
|
34
|
+
mutation RestoreSomeObjectMutation($id: ID!) {
|
|
35
|
+
restoreSomeObject(where: { id: $id })
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
export const CREATE_REVIEW = gql`
|
|
40
|
+
mutation CreateReviewMutation($data: CreateReview!) {
|
|
41
|
+
createReview(data: $data) { id }
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
export const UPDATE_REVIEW = gql`
|
|
46
|
+
mutation UpdateReviewMutation($id: ID!, $data: UpdateReview!) {
|
|
47
|
+
updateReview(where: { id: $id }, data: $data) { id }
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
export const DELETE_REVIEW = gql`
|
|
52
|
+
mutation DeleteReviewMutation($id: ID!) {
|
|
53
|
+
deleteReview(where: { id: $id })
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
export const RESTORE_REVIEW = gql`
|
|
58
|
+
mutation RestoreReviewMutation($id: ID!) {
|
|
59
|
+
restoreReview(where: { id: $id })
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
export const CREATE_QUESTION = gql`
|
|
64
|
+
mutation CreateQuestionMutation($data: CreateQuestion!) {
|
|
65
|
+
createQuestion(data: $data) { id }
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
export const UPDATE_QUESTION = gql`
|
|
70
|
+
mutation UpdateQuestionMutation($id: ID!, $data: UpdateQuestion!) {
|
|
71
|
+
updateQuestion(where: { id: $id }, data: $data) { id }
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
export const DELETE_QUESTION = gql`
|
|
76
|
+
mutation DeleteQuestionMutation($id: ID!) {
|
|
77
|
+
deleteQuestion(where: { id: $id })
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
export const RESTORE_QUESTION = gql`
|
|
82
|
+
mutation RestoreQuestionMutation($id: ID!) {
|
|
83
|
+
restoreQuestion(where: { id: $id })
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
export const CREATE_ANSWER = gql`
|
|
88
|
+
mutation CreateAnswerMutation($data: CreateAnswer!) {
|
|
89
|
+
createAnswer(data: $data) { id }
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
export const UPDATE_ANSWER = gql`
|
|
94
|
+
mutation UpdateAnswerMutation($id: ID!, $data: UpdateAnswer!) {
|
|
95
|
+
updateAnswer(where: { id: $id }, data: $data) { id }
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
export const DELETE_ANSWER = gql`
|
|
100
|
+
mutation DeleteAnswerMutation($id: ID!) {
|
|
101
|
+
deleteAnswer(where: { id: $id })
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
|
|
105
|
+
export const RESTORE_ANSWER = gql`
|
|
106
|
+
mutation RestoreAnswerMutation($id: ID!) {
|
|
107
|
+
restoreAnswer(where: { id: $id })
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
|
|
3
|
+
export type SomeEnum = 'A' | 'B' | 'C';
|
|
4
|
+
|
|
5
|
+
export type Role = 'ADMIN' | 'USER';
|
|
6
|
+
|
|
7
|
+
export type ReactionType = 'Review' | 'Question' | 'Answer';
|
|
8
|
+
|
|
9
|
+
export type User = {
|
|
10
|
+
'id': string;
|
|
11
|
+
'username': string | null;
|
|
12
|
+
'role': Role | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type UserInitializer = {
|
|
16
|
+
'id': string;
|
|
17
|
+
'username'?: string | null;
|
|
18
|
+
'role'?: Role | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type UserMutator = {
|
|
22
|
+
'id'?: string;
|
|
23
|
+
'username'?: string | null;
|
|
24
|
+
'role'?: Role | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type UserSeed = {
|
|
28
|
+
'id': string;
|
|
29
|
+
'username'?: string | null;
|
|
30
|
+
'role'?: string | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type AnotherObject = {
|
|
34
|
+
'id': string;
|
|
35
|
+
'name': string | null;
|
|
36
|
+
'myselfId': string | null;
|
|
37
|
+
'deleted': boolean;
|
|
38
|
+
'deletedAt': DateTime | string | null;
|
|
39
|
+
'deletedById': string | null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type AnotherObjectInitializer = {
|
|
43
|
+
'id': string;
|
|
44
|
+
'name'?: string | null;
|
|
45
|
+
'myselfId'?: string | null;
|
|
46
|
+
'deleted'?: boolean;
|
|
47
|
+
'deletedAt'?: DateTime | string | null;
|
|
48
|
+
'deletedById'?: string | null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type AnotherObjectMutator = {
|
|
52
|
+
'id'?: string;
|
|
53
|
+
'name'?: string | null;
|
|
54
|
+
'myselfId'?: string | null;
|
|
55
|
+
'deleted'?: boolean;
|
|
56
|
+
'deletedAt'?: DateTime | string | null;
|
|
57
|
+
'deletedById'?: string | null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type AnotherObjectSeed = {
|
|
61
|
+
'id': string;
|
|
62
|
+
'name'?: string | null;
|
|
63
|
+
'myselfId'?: string | null;
|
|
64
|
+
'deleted'?: boolean;
|
|
65
|
+
'deletedAt'?: DateTime | string | null;
|
|
66
|
+
'deletedById'?: string | null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type SomeObject = {
|
|
70
|
+
'id': string;
|
|
71
|
+
'field': string | null;
|
|
72
|
+
'anotherId': string;
|
|
73
|
+
'float': number;
|
|
74
|
+
'list': SomeEnum[];
|
|
75
|
+
'xyz': number;
|
|
76
|
+
'createdAt': DateTime | string;
|
|
77
|
+
'createdById': string;
|
|
78
|
+
'updatedAt': DateTime | string;
|
|
79
|
+
'updatedById': string;
|
|
80
|
+
'deleted': boolean;
|
|
81
|
+
'deletedAt': DateTime | string | null;
|
|
82
|
+
'deletedById': string | null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type SomeObjectInitializer = {
|
|
86
|
+
'id': string;
|
|
87
|
+
'field'?: string | null;
|
|
88
|
+
'anotherId': string;
|
|
89
|
+
'float': number;
|
|
90
|
+
'list': SomeEnum[] | string;
|
|
91
|
+
'xyz': number;
|
|
92
|
+
'createdAt': DateTime | string;
|
|
93
|
+
'createdById': string;
|
|
94
|
+
'updatedAt': DateTime | string;
|
|
95
|
+
'updatedById': string;
|
|
96
|
+
'deleted'?: boolean;
|
|
97
|
+
'deletedAt'?: DateTime | string | null;
|
|
98
|
+
'deletedById'?: string | null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type SomeObjectMutator = {
|
|
102
|
+
'id'?: string;
|
|
103
|
+
'field'?: string | null;
|
|
104
|
+
'anotherId'?: string;
|
|
105
|
+
'float'?: number;
|
|
106
|
+
'list'?: SomeEnum[] | string;
|
|
107
|
+
'xyz'?: number;
|
|
108
|
+
'createdAt'?: DateTime | string;
|
|
109
|
+
'createdById'?: string;
|
|
110
|
+
'updatedAt'?: DateTime | string;
|
|
111
|
+
'updatedById'?: string;
|
|
112
|
+
'deleted'?: boolean;
|
|
113
|
+
'deletedAt'?: DateTime | string | null;
|
|
114
|
+
'deletedById'?: string | null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export type SomeObjectSeed = {
|
|
118
|
+
'id': string;
|
|
119
|
+
'field'?: string | null;
|
|
120
|
+
'anotherId': string;
|
|
121
|
+
'float': number;
|
|
122
|
+
'list': string[] | string;
|
|
123
|
+
'xyz': number;
|
|
124
|
+
'createdAt'?: DateTime | string;
|
|
125
|
+
'createdById'?: string;
|
|
126
|
+
'updatedAt'?: DateTime | string;
|
|
127
|
+
'updatedById'?: string;
|
|
128
|
+
'deleted'?: boolean;
|
|
129
|
+
'deletedAt'?: DateTime | string | null;
|
|
130
|
+
'deletedById'?: string | null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type Reaction = {
|
|
134
|
+
'id': string;
|
|
135
|
+
'type': ReactionType;
|
|
136
|
+
'parentId': string | null;
|
|
137
|
+
'content': string | null;
|
|
138
|
+
'createdAt': DateTime | string;
|
|
139
|
+
'createdById': string;
|
|
140
|
+
'updatedAt': DateTime | string;
|
|
141
|
+
'updatedById': string;
|
|
142
|
+
'deleted': boolean;
|
|
143
|
+
'deletedAt': DateTime | string | null;
|
|
144
|
+
'deletedById': string | null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type ReactionInitializer = {
|
|
148
|
+
'id': string;
|
|
149
|
+
'type': ReactionType;
|
|
150
|
+
'parentId'?: string | null;
|
|
151
|
+
'content'?: string | null;
|
|
152
|
+
'createdAt': DateTime | string;
|
|
153
|
+
'createdById': string;
|
|
154
|
+
'updatedAt': DateTime | string;
|
|
155
|
+
'updatedById': string;
|
|
156
|
+
'deleted'?: boolean;
|
|
157
|
+
'deletedAt'?: DateTime | string | null;
|
|
158
|
+
'deletedById'?: string | null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export type ReactionMutator = {
|
|
162
|
+
'id'?: string;
|
|
163
|
+
'type'?: ReactionType;
|
|
164
|
+
'parentId'?: string | null;
|
|
165
|
+
'content'?: string | null;
|
|
166
|
+
'createdAt'?: DateTime | string;
|
|
167
|
+
'createdById'?: string;
|
|
168
|
+
'updatedAt'?: DateTime | string;
|
|
169
|
+
'updatedById'?: string;
|
|
170
|
+
'deleted'?: boolean;
|
|
171
|
+
'deletedAt'?: DateTime | string | null;
|
|
172
|
+
'deletedById'?: string | null;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export type Review = {
|
|
176
|
+
'id': string;
|
|
177
|
+
'type': ReactionType;
|
|
178
|
+
'parentId': string | null;
|
|
179
|
+
'content': string | null;
|
|
180
|
+
'createdAt': DateTime | string;
|
|
181
|
+
'createdById': string;
|
|
182
|
+
'updatedAt': DateTime | string;
|
|
183
|
+
'updatedById': string;
|
|
184
|
+
'deleted': boolean;
|
|
185
|
+
'deletedAt': DateTime | string | null;
|
|
186
|
+
'deletedById': string | null;
|
|
187
|
+
'rating': number | null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export type ReviewInitializer = {
|
|
191
|
+
'id': string;
|
|
192
|
+
'rating'?: number | null;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export type ReviewMutator = {
|
|
196
|
+
'id'?: string;
|
|
197
|
+
'rating'?: number | null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export type ReviewSeed = {
|
|
201
|
+
'id': string;
|
|
202
|
+
'parentId'?: string | null;
|
|
203
|
+
'content'?: string | null;
|
|
204
|
+
'createdAt'?: DateTime | string;
|
|
205
|
+
'createdById'?: string;
|
|
206
|
+
'updatedAt'?: DateTime | string;
|
|
207
|
+
'updatedById'?: string;
|
|
208
|
+
'deleted'?: boolean;
|
|
209
|
+
'deletedAt'?: DateTime | string | null;
|
|
210
|
+
'deletedById'?: string | null;
|
|
211
|
+
'rating'?: number | null;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export type Question = {
|
|
215
|
+
'id': string;
|
|
216
|
+
'type': ReactionType;
|
|
217
|
+
'parentId': string | null;
|
|
218
|
+
'content': string | null;
|
|
219
|
+
'createdAt': DateTime | string;
|
|
220
|
+
'createdById': string;
|
|
221
|
+
'updatedAt': DateTime | string;
|
|
222
|
+
'updatedById': string;
|
|
223
|
+
'deleted': boolean;
|
|
224
|
+
'deletedAt': DateTime | string | null;
|
|
225
|
+
'deletedById': string | null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export type QuestionInitializer = {
|
|
229
|
+
'id': string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export type QuestionMutator = {
|
|
233
|
+
'id'?: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export type QuestionSeed = {
|
|
237
|
+
'id': string;
|
|
238
|
+
'parentId'?: string | null;
|
|
239
|
+
'content'?: string | null;
|
|
240
|
+
'createdAt'?: DateTime | string;
|
|
241
|
+
'createdById'?: string;
|
|
242
|
+
'updatedAt'?: DateTime | string;
|
|
243
|
+
'updatedById'?: string;
|
|
244
|
+
'deleted'?: boolean;
|
|
245
|
+
'deletedAt'?: DateTime | string | null;
|
|
246
|
+
'deletedById'?: string | null;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export type Answer = {
|
|
250
|
+
'id': string;
|
|
251
|
+
'type': ReactionType;
|
|
252
|
+
'parentId': string | null;
|
|
253
|
+
'content': string | null;
|
|
254
|
+
'createdAt': DateTime | string;
|
|
255
|
+
'createdById': string;
|
|
256
|
+
'updatedAt': DateTime | string;
|
|
257
|
+
'updatedById': string;
|
|
258
|
+
'deleted': boolean;
|
|
259
|
+
'deletedAt': DateTime | string | null;
|
|
260
|
+
'deletedById': string | null;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export type AnswerInitializer = {
|
|
264
|
+
'id': string;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export type AnswerMutator = {
|
|
268
|
+
'id'?: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export type AnswerSeed = {
|
|
272
|
+
'id': string;
|
|
273
|
+
'parentId'?: string | null;
|
|
274
|
+
'content'?: string | null;
|
|
275
|
+
'createdAt'?: DateTime | string;
|
|
276
|
+
'createdById'?: string;
|
|
277
|
+
'updatedAt'?: DateTime | string;
|
|
278
|
+
'updatedById'?: string;
|
|
279
|
+
'deleted'?: boolean;
|
|
280
|
+
'deletedAt'?: DateTime | string | null;
|
|
281
|
+
'deletedById'?: string | null;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export type SeedData = {
|
|
285
|
+
User: UserSeed[];
|
|
286
|
+
AnotherObject: AnotherObjectSeed[];
|
|
287
|
+
SomeObject: SomeObjectSeed[];
|
|
288
|
+
Review: ReviewSeed[];
|
|
289
|
+
Question: QuestionSeed[];
|
|
290
|
+
Answer: AnswerSeed[];
|
|
291
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Knex } from 'knex';
|
|
2
|
+
import { User, UserInitializer, UserMutator, AnotherObject, AnotherObjectInitializer, AnotherObjectMutator, SomeObject, SomeObjectInitializer, SomeObjectMutator, Reaction, ReactionInitializer, ReactionMutator, Review, ReviewInitializer, ReviewMutator, Question, QuestionInitializer, QuestionMutator, Answer, AnswerInitializer, AnswerMutator } from '.';
|
|
3
|
+
|
|
4
|
+
declare module 'knex/types/tables' {
|
|
5
|
+
interface Tables {
|
|
6
|
+
'User': Knex.CompositeTableType<User, UserInitializer, UserMutator>,
|
|
7
|
+
'AnotherObject': Knex.CompositeTableType<AnotherObject, AnotherObjectInitializer, AnotherObjectMutator>,
|
|
8
|
+
'SomeObject': Knex.CompositeTableType<SomeObject, SomeObjectInitializer, SomeObjectMutator>,
|
|
9
|
+
'Reaction': Knex.CompositeTableType<Reaction, ReactionInitializer, ReactionMutator>,
|
|
10
|
+
'Review': Knex.CompositeTableType<Review, ReviewInitializer, ReviewMutator>,
|
|
11
|
+
'Question': Knex.CompositeTableType<Question, QuestionInitializer, QuestionMutator>,
|
|
12
|
+
'Answer': Knex.CompositeTableType<Answer, AnswerInitializer, AnswerMutator>,
|
|
13
|
+
}
|
|
14
|
+
}
|