@smartive/graphql-magic 18.0.0 → 19.0.0-next.1

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.
@@ -148,36 +148,50 @@ const del = async (model: EntityModel, { where, dryRun }: { where: any; dryRun:
148
148
  }
149
149
  >
150
150
  > = {};
151
+ const restricted: Record<
152
+ string,
153
+ Record<
154
+ string,
155
+ {
156
+ display: string;
157
+ fields: string[];
158
+ }
159
+ >
160
+ > = {};
151
161
 
152
162
  const beforeHooks: Callbacks = [];
153
163
  const mutations: Callbacks = [];
154
164
  const afterHooks: Callbacks = [];
155
165
 
156
- const deleteCascade = async (currentModel: EntityModel, entity: Entity) => {
157
- if (entity.deleted) {
158
- return;
159
- }
160
-
166
+ const mutationHook = ctx.mutationHook;
167
+ const deleteCascade = async (currentModel: EntityModel, currentEntity: Entity) => {
161
168
  if (!(currentModel.name in toDelete)) {
162
169
  toDelete[currentModel.name] = {};
163
170
  }
164
- if ((entity.id as string) in toDelete[currentModel.name]) {
171
+ if ((currentEntity.id as string) in toDelete[currentModel.name]) {
165
172
  return;
166
173
  }
167
- toDelete[currentModel.name][entity.id as string] = (entity[currentModel.displayField || 'id'] || entity.id) as string;
174
+ toDelete[currentModel.name][currentEntity.id as string] = (currentEntity[currentModel.displayField || 'id'] ||
175
+ currentEntity.id) as string;
168
176
 
169
177
  if (!dryRun) {
170
- const normalizedInput = { deleted: true, deletedAt: ctx.now, deletedById: ctx.user?.id };
171
- const data = { prev: entity, input: {}, normalizedInput, next: { ...entity, ...normalizedInput } };
172
- const mutationHook = ctx.mutationHook;
178
+ const normalizedInput = {
179
+ deleted: true,
180
+ deletedAt: ctx.now,
181
+ deletedById: ctx.user?.id,
182
+ deleteRootType: rootModel.name,
183
+ deleteRootId: entity.id,
184
+ };
185
+ const next = { ...currentEntity, ...normalizedInput };
186
+ const data = { prev: currentEntity, input: {}, normalizedInput, next };
173
187
  if (mutationHook) {
174
188
  beforeHooks.push(async () => {
175
189
  await mutationHook(currentModel, 'delete', 'before', data, ctx);
176
190
  });
177
191
  }
178
192
  mutations.push(async () => {
179
- await ctx.knex(currentModel.name).where({ id: entity.id }).update(normalizedInput);
180
- await createRevision(currentModel, { ...entity, deleted: true }, ctx);
193
+ await ctx.knex(currentModel.name).where({ id: currentEntity.id }).update(normalizedInput);
194
+ await createRevision(currentModel, next, ctx);
181
195
  });
182
196
  if (mutationHook) {
183
197
  afterHooks.push(async () => {
@@ -190,7 +204,7 @@ const del = async (model: EntityModel, { where, dryRun }: { where: any; dryRun:
190
204
  targetModel: descendantModel,
191
205
  field: { name, foreignKey, onDelete },
192
206
  } of currentModel.reverseRelations.filter((reverseRelation) => !reverseRelation.field.inherited)) {
193
- const query = ctx.knex(descendantModel.name).where({ [foreignKey]: entity.id });
207
+ const query = ctx.knex(descendantModel.name).where({ [foreignKey]: currentEntity.id, deleted: false });
194
208
  switch (onDelete) {
195
209
  case 'set-null': {
196
210
  const descendants = await query;
@@ -201,20 +215,51 @@ const del = async (model: EntityModel, { where, dryRun }: { where: any; dryRun:
201
215
  }
202
216
  if (!toUnlink[descendantModel.name][descendant.id]) {
203
217
  toUnlink[descendantModel.name][descendant.id] = {
204
- display: descendant[descendantModel.displayField || 'id'] || entity.id,
218
+ display: descendant[descendantModel.displayField || 'id'] || currentEntity.id,
205
219
  fields: [],
206
220
  };
207
221
  }
208
222
  toUnlink[descendantModel.name][descendant.id].fields.push(name);
209
223
  } else {
224
+ const normalizedInput = { [`${name}Id`]: null };
225
+ const next = { ...descendant, ...normalizedInput };
226
+ const data = { prev: descendant, input: {}, normalizedInput, next };
227
+ if (mutationHook) {
228
+ beforeHooks.push(async () => {
229
+ await mutationHook(descendantModel, 'update', 'before', data, ctx);
230
+ });
231
+ }
210
232
  mutations.push(async () => {
211
- await ctx
212
- .knex(descendantModel.name)
213
- .where({ id: descendant.id })
214
- .update({
215
- [`${name}Id`]: null,
216
- });
233
+ await ctx.knex(descendantModel.name).where({ id: descendant.id }).update(normalizedInput);
234
+ await createRevision(descendantModel, next, ctx);
217
235
  });
236
+ if (mutationHook) {
237
+ afterHooks.push(async () => {
238
+ await mutationHook(descendantModel, 'update', 'after', data, ctx);
239
+ });
240
+ }
241
+ }
242
+ }
243
+ break;
244
+ }
245
+ case 'restrict': {
246
+ const descendants = await query;
247
+ if (descendants.length) {
248
+ if (dryRun) {
249
+ if (!restricted[descendantModel.name]) {
250
+ restricted[descendantModel.name] = {};
251
+ }
252
+ for (const descendant of descendants) {
253
+ if (!restricted[descendantModel.name][descendant.id]) {
254
+ restricted[descendantModel.name][descendant.id] = {
255
+ display: descendant[descendantModel.displayField || 'id'] || currentEntity.id,
256
+ fields: [name],
257
+ };
258
+ }
259
+ restricted[descendantModel.name][descendant.id].fields.push(name);
260
+ }
261
+ } else {
262
+ throw new ForbiddenError(`This ${model.name} cannot be deleted because it has ${descendantModel.plural}.`);
218
263
  }
219
264
  }
220
265
  break;
@@ -265,20 +310,24 @@ const restore = async (model: EntityModel, { where }: { where: any }, ctx: FullC
265
310
  throw new ForbiddenError('Entity is not deleted.');
266
311
  }
267
312
 
313
+ if (!(entity.deleteRootType === rootModel.name && entity.deleteRootId === entity.id)) {
314
+ throw new ForbiddenError(
315
+ `Can't restore ${model.rootModel.name} directly. Please restore ${entity.deleteRootType} ${entity.deleteRootId} instead.`,
316
+ );
317
+ }
318
+
268
319
  const beforeHooks: Callbacks = [];
269
320
  const mutations: Callbacks = [];
270
321
  const afterHooks: Callbacks = [];
271
322
 
272
323
  const restoreCascade = async (currentModel: EntityModel, relatedEntity: Entity) => {
273
- if (
274
- !relatedEntity.deleted ||
275
- !relatedEntity.deletedAt ||
276
- !anyDateToLuxon(relatedEntity.deletedAt, ctx.timeZone)!.equals(anyDateToLuxon(entity.deletedAt, ctx.timeZone)!)
277
- ) {
278
- return;
279
- }
280
-
281
- const normalizedInput: Entity = { deleted: false, deletedAt: null, deletedById: null };
324
+ const normalizedInput: Entity = {
325
+ deleted: false,
326
+ deletedAt: null,
327
+ deletedById: null,
328
+ deleteRootType: null,
329
+ deleteRootId: null,
330
+ };
282
331
  const data = { prev: relatedEntity, input: {}, normalizedInput, next: { ...relatedEntity, ...normalizedInput } };
283
332
  if (ctx.mutationHook) {
284
333
  beforeHooks.push(async () => {
@@ -21,6 +21,8 @@ export type Scalars = {
21
21
 
22
22
  export type AnotherObject = {
23
23
  __typename?: 'AnotherObject';
24
+ deleteRootId?: Maybe<Scalars['ID']['output']>;
25
+ deleteRootType?: Maybe<Scalars['String']['output']>;
24
26
  deleted: Scalars['Boolean']['output'];
25
27
  deletedAt?: Maybe<Scalars['DateTime']['output']>;
26
28
  deletedBy?: Maybe<User>;
@@ -76,6 +78,8 @@ export type Answer = Reaction & {
76
78
  content?: Maybe<Scalars['String']['output']>;
77
79
  createdAt: Scalars['DateTime']['output'];
78
80
  createdBy: User;
81
+ deleteRootId?: Maybe<Scalars['ID']['output']>;
82
+ deleteRootType?: Maybe<Scalars['String']['output']>;
79
83
  deleted: Scalars['Boolean']['output'];
80
84
  deletedAt?: Maybe<Scalars['DateTime']['output']>;
81
85
  deletedBy?: Maybe<User>;
@@ -378,6 +382,8 @@ export type Question = Reaction & {
378
382
  content?: Maybe<Scalars['String']['output']>;
379
383
  createdAt: Scalars['DateTime']['output'];
380
384
  createdBy: User;
385
+ deleteRootId?: Maybe<Scalars['ID']['output']>;
386
+ deleteRootType?: Maybe<Scalars['String']['output']>;
381
387
  deleted: Scalars['Boolean']['output'];
382
388
  deletedAt?: Maybe<Scalars['DateTime']['output']>;
383
389
  deletedBy?: Maybe<User>;
@@ -446,6 +452,8 @@ export type Reaction = {
446
452
  content?: Maybe<Scalars['String']['output']>;
447
453
  createdAt: Scalars['DateTime']['output'];
448
454
  createdBy: User;
455
+ deleteRootId?: Maybe<Scalars['ID']['output']>;
456
+ deleteRootType?: Maybe<Scalars['String']['output']>;
449
457
  deleted: Scalars['Boolean']['output'];
450
458
  deletedAt?: Maybe<Scalars['DateTime']['output']>;
451
459
  deletedBy?: Maybe<User>;
@@ -521,6 +529,8 @@ export type Review = Reaction & {
521
529
  content?: Maybe<Scalars['String']['output']>;
522
530
  createdAt: Scalars['DateTime']['output'];
523
531
  createdBy: User;
532
+ deleteRootId?: Maybe<Scalars['ID']['output']>;
533
+ deleteRootType?: Maybe<Scalars['String']['output']>;
524
534
  deleted: Scalars['Boolean']['output'];
525
535
  deletedAt?: Maybe<Scalars['DateTime']['output']>;
526
536
  deletedBy?: Maybe<User>;
@@ -602,6 +612,8 @@ export type SomeObject = {
602
612
  another?: Maybe<AnotherObject>;
603
613
  createdAt: Scalars['DateTime']['output'];
604
614
  createdBy: User;
615
+ deleteRootId?: Maybe<Scalars['ID']['output']>;
616
+ deleteRootType?: Maybe<Scalars['String']['output']>;
605
617
  deleted: Scalars['Boolean']['output'];
606
618
  deletedAt?: Maybe<Scalars['DateTime']['output']>;
607
619
  deletedBy?: Maybe<User>;
@@ -1006,6 +1018,8 @@ export type ResolversParentTypes = {
1006
1018
  };
1007
1019
 
1008
1020
  export type AnotherObjectResolvers<ContextType = any, ParentType extends ResolversParentTypes['AnotherObject'] = ResolversParentTypes['AnotherObject']> = {
1021
+ deleteRootId?: Resolver<Maybe<ResolversTypes['ID']>, ParentType, ContextType>;
1022
+ deleteRootType?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1009
1023
  deleted?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
1010
1024
  deletedAt?: Resolver<Maybe<ResolversTypes['DateTime']>, ParentType, ContextType>;
1011
1025
  deletedBy?: Resolver<Maybe<ResolversTypes['User']>, ParentType, ContextType>;
@@ -1025,6 +1039,8 @@ export type AnswerResolvers<ContextType = any, ParentType extends ResolversParen
1025
1039
  content?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1026
1040
  createdAt?: Resolver<ResolversTypes['DateTime'], ParentType, ContextType>;
1027
1041
  createdBy?: Resolver<ResolversTypes['User'], ParentType, ContextType>;
1042
+ deleteRootId?: Resolver<Maybe<ResolversTypes['ID']>, ParentType, ContextType>;
1043
+ deleteRootType?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1028
1044
  deleted?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
1029
1045
  deletedAt?: Resolver<Maybe<ResolversTypes['DateTime']>, ParentType, ContextType>;
1030
1046
  deletedBy?: Resolver<Maybe<ResolversTypes['User']>, ParentType, ContextType>;
@@ -1084,6 +1100,8 @@ export type QuestionResolvers<ContextType = any, ParentType extends ResolversPar
1084
1100
  content?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1085
1101
  createdAt?: Resolver<ResolversTypes['DateTime'], ParentType, ContextType>;
1086
1102
  createdBy?: Resolver<ResolversTypes['User'], ParentType, ContextType>;
1103
+ deleteRootId?: Resolver<Maybe<ResolversTypes['ID']>, ParentType, ContextType>;
1104
+ deleteRootType?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1087
1105
  deleted?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
1088
1106
  deletedAt?: Resolver<Maybe<ResolversTypes['DateTime']>, ParentType, ContextType>;
1089
1107
  deletedBy?: Resolver<Maybe<ResolversTypes['User']>, ParentType, ContextType>;
@@ -1104,6 +1122,8 @@ export type ReactionResolvers<ContextType = any, ParentType extends ResolversPar
1104
1122
  content?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1105
1123
  createdAt?: Resolver<ResolversTypes['DateTime'], ParentType, ContextType>;
1106
1124
  createdBy?: Resolver<ResolversTypes['User'], ParentType, ContextType>;
1125
+ deleteRootId?: Resolver<Maybe<ResolversTypes['ID']>, ParentType, ContextType>;
1126
+ deleteRootType?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1107
1127
  deleted?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
1108
1128
  deletedAt?: Resolver<Maybe<ResolversTypes['DateTime']>, ParentType, ContextType>;
1109
1129
  deletedBy?: Resolver<Maybe<ResolversTypes['User']>, ParentType, ContextType>;
@@ -1122,6 +1142,8 @@ export type ReviewResolvers<ContextType = any, ParentType extends ResolversParen
1122
1142
  content?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1123
1143
  createdAt?: Resolver<ResolversTypes['DateTime'], ParentType, ContextType>;
1124
1144
  createdBy?: Resolver<ResolversTypes['User'], ParentType, ContextType>;
1145
+ deleteRootId?: Resolver<Maybe<ResolversTypes['ID']>, ParentType, ContextType>;
1146
+ deleteRootType?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1125
1147
  deleted?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
1126
1148
  deletedAt?: Resolver<Maybe<ResolversTypes['DateTime']>, ParentType, ContextType>;
1127
1149
  deletedBy?: Resolver<Maybe<ResolversTypes['User']>, ParentType, ContextType>;
@@ -1138,6 +1160,8 @@ export type SomeObjectResolvers<ContextType = any, ParentType extends ResolversP
1138
1160
  another?: Resolver<Maybe<ResolversTypes['AnotherObject']>, ParentType, ContextType>;
1139
1161
  createdAt?: Resolver<ResolversTypes['DateTime'], ParentType, ContextType>;
1140
1162
  createdBy?: Resolver<ResolversTypes['User'], ParentType, ContextType>;
1163
+ deleteRootId?: Resolver<Maybe<ResolversTypes['ID']>, ParentType, ContextType>;
1164
+ deleteRootType?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
1141
1165
  deleted?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
1142
1166
  deletedAt?: Resolver<Maybe<ResolversTypes['DateTime']>, ParentType, ContextType>;
1143
1167
  deletedBy?: Resolver<Maybe<ResolversTypes['User']>, ParentType, ContextType>;
@@ -18,6 +18,8 @@ export type Scalars = {
18
18
 
19
19
  export type AnotherObject = {
20
20
  __typename: 'AnotherObject';
21
+ deleteRootId: Maybe<Scalars['ID']['output']>;
22
+ deleteRootType: Maybe<Scalars['String']['output']>;
21
23
  deleted: Scalars['Boolean']['output'];
22
24
  deletedAt: Maybe<Scalars['DateTime']['output']>;
23
25
  deletedBy: Maybe<User>;
@@ -73,6 +75,8 @@ export type Answer = Reaction & {
73
75
  content: Maybe<Scalars['String']['output']>;
74
76
  createdAt: Scalars['DateTime']['output'];
75
77
  createdBy: User;
78
+ deleteRootId: Maybe<Scalars['ID']['output']>;
79
+ deleteRootType: Maybe<Scalars['String']['output']>;
76
80
  deleted: Scalars['Boolean']['output'];
77
81
  deletedAt: Maybe<Scalars['DateTime']['output']>;
78
82
  deletedBy: Maybe<User>;
@@ -375,6 +379,8 @@ export type Question = Reaction & {
375
379
  content: Maybe<Scalars['String']['output']>;
376
380
  createdAt: Scalars['DateTime']['output'];
377
381
  createdBy: User;
382
+ deleteRootId: Maybe<Scalars['ID']['output']>;
383
+ deleteRootType: Maybe<Scalars['String']['output']>;
378
384
  deleted: Scalars['Boolean']['output'];
379
385
  deletedAt: Maybe<Scalars['DateTime']['output']>;
380
386
  deletedBy: Maybe<User>;
@@ -443,6 +449,8 @@ export type Reaction = {
443
449
  content: Maybe<Scalars['String']['output']>;
444
450
  createdAt: Scalars['DateTime']['output'];
445
451
  createdBy: User;
452
+ deleteRootId: Maybe<Scalars['ID']['output']>;
453
+ deleteRootType: Maybe<Scalars['String']['output']>;
446
454
  deleted: Scalars['Boolean']['output'];
447
455
  deletedAt: Maybe<Scalars['DateTime']['output']>;
448
456
  deletedBy: Maybe<User>;
@@ -518,6 +526,8 @@ export type Review = Reaction & {
518
526
  content: Maybe<Scalars['String']['output']>;
519
527
  createdAt: Scalars['DateTime']['output'];
520
528
  createdBy: User;
529
+ deleteRootId: Maybe<Scalars['ID']['output']>;
530
+ deleteRootType: Maybe<Scalars['String']['output']>;
521
531
  deleted: Scalars['Boolean']['output'];
522
532
  deletedAt: Maybe<Scalars['DateTime']['output']>;
523
533
  deletedBy: Maybe<User>;
@@ -599,6 +609,8 @@ export type SomeObject = {
599
609
  another: Maybe<AnotherObject>;
600
610
  createdAt: Scalars['DateTime']['output'];
601
611
  createdBy: User;
612
+ deleteRootId: Maybe<Scalars['ID']['output']>;
613
+ deleteRootType: Maybe<Scalars['String']['output']>;
602
614
  deleted: Scalars['Boolean']['output'];
603
615
  deletedAt: Maybe<Scalars['DateTime']['output']>;
604
616
  deletedBy: Maybe<User>;
@@ -37,6 +37,8 @@ export type AnotherObject = {
37
37
  'deleted': boolean;
38
38
  'deletedAt': DateTime | null;
39
39
  'deletedById': string | null;
40
+ 'deleteRootType': string | null;
41
+ 'deleteRootId': string | null;
40
42
  }
41
43
 
42
44
  export type AnotherObjectInitializer = {
@@ -46,6 +48,8 @@ export type AnotherObjectInitializer = {
46
48
  'deleted'?: boolean;
47
49
  'deletedAt'?: (DateTime | string) | null;
48
50
  'deletedById'?: string | null;
51
+ 'deleteRootType'?: string | null;
52
+ 'deleteRootId'?: string | null;
49
53
  }
50
54
 
51
55
  export type AnotherObjectMutator = {
@@ -55,6 +59,8 @@ export type AnotherObjectMutator = {
55
59
  'deleted'?: boolean;
56
60
  'deletedAt'?: (DateTime | string) | null;
57
61
  'deletedById'?: string | null;
62
+ 'deleteRootType'?: string | null;
63
+ 'deleteRootId'?: string | null;
58
64
  }
59
65
 
60
66
  export type AnotherObjectSeed = {
@@ -64,6 +70,8 @@ export type AnotherObjectSeed = {
64
70
  'deleted'?: boolean;
65
71
  'deletedAt'?: (DateTime | string) | null;
66
72
  'deletedById'?: string | null;
73
+ 'deleteRootType'?: string | null;
74
+ 'deleteRootId'?: string | null;
67
75
  }
68
76
 
69
77
  export type SomeObject = {
@@ -80,6 +88,8 @@ export type SomeObject = {
80
88
  'deleted': boolean;
81
89
  'deletedAt': DateTime | null;
82
90
  'deletedById': string | null;
91
+ 'deleteRootType': string | null;
92
+ 'deleteRootId': string | null;
83
93
  }
84
94
 
85
95
  export type SomeObjectInitializer = {
@@ -96,6 +106,8 @@ export type SomeObjectInitializer = {
96
106
  'deleted'?: boolean;
97
107
  'deletedAt'?: (DateTime | string) | null;
98
108
  'deletedById'?: string | null;
109
+ 'deleteRootType'?: string | null;
110
+ 'deleteRootId'?: string | null;
99
111
  }
100
112
 
101
113
  export type SomeObjectMutator = {
@@ -112,6 +124,8 @@ export type SomeObjectMutator = {
112
124
  'deleted'?: boolean;
113
125
  'deletedAt'?: (DateTime | string) | null;
114
126
  'deletedById'?: string | null;
127
+ 'deleteRootType'?: string | null;
128
+ 'deleteRootId'?: string | null;
115
129
  }
116
130
 
117
131
  export type SomeObjectSeed = {
@@ -128,6 +142,8 @@ export type SomeObjectSeed = {
128
142
  'deleted'?: boolean;
129
143
  'deletedAt'?: (DateTime | string) | null;
130
144
  'deletedById'?: string | null;
145
+ 'deleteRootType'?: string | null;
146
+ 'deleteRootId'?: string | null;
131
147
  }
132
148
 
133
149
  export type Reaction = {
@@ -142,6 +158,8 @@ export type Reaction = {
142
158
  'deleted': boolean;
143
159
  'deletedAt': DateTime | null;
144
160
  'deletedById': string | null;
161
+ 'deleteRootType': string | null;
162
+ 'deleteRootId': string | null;
145
163
  }
146
164
 
147
165
  export type ReactionInitializer = {
@@ -156,6 +174,8 @@ export type ReactionInitializer = {
156
174
  'deleted'?: boolean;
157
175
  'deletedAt'?: (DateTime | string) | null;
158
176
  'deletedById'?: string | null;
177
+ 'deleteRootType'?: string | null;
178
+ 'deleteRootId'?: string | null;
159
179
  }
160
180
 
161
181
  export type ReactionMutator = {
@@ -170,6 +190,8 @@ export type ReactionMutator = {
170
190
  'deleted'?: boolean;
171
191
  'deletedAt'?: (DateTime | string) | null;
172
192
  'deletedById'?: string | null;
193
+ 'deleteRootType'?: string | null;
194
+ 'deleteRootId'?: string | null;
173
195
  }
174
196
 
175
197
  export type Review = {
@@ -184,6 +206,8 @@ export type Review = {
184
206
  'deleted': boolean;
185
207
  'deletedAt': DateTime | null;
186
208
  'deletedById': string | null;
209
+ 'deleteRootType': string | null;
210
+ 'deleteRootId': string | null;
187
211
  'rating': number | null;
188
212
  }
189
213
 
@@ -208,6 +232,8 @@ export type ReviewSeed = {
208
232
  'deleted'?: boolean;
209
233
  'deletedAt'?: (DateTime | string) | null;
210
234
  'deletedById'?: string | null;
235
+ 'deleteRootType'?: string | null;
236
+ 'deleteRootId'?: string | null;
211
237
  'rating'?: number | null;
212
238
  }
213
239
 
@@ -223,6 +249,8 @@ export type Question = {
223
249
  'deleted': boolean;
224
250
  'deletedAt': DateTime | null;
225
251
  'deletedById': string | null;
252
+ 'deleteRootType': string | null;
253
+ 'deleteRootId': string | null;
226
254
  }
227
255
 
228
256
  export type QuestionInitializer = {
@@ -244,6 +272,8 @@ export type QuestionSeed = {
244
272
  'deleted'?: boolean;
245
273
  'deletedAt'?: (DateTime | string) | null;
246
274
  'deletedById'?: string | null;
275
+ 'deleteRootType'?: string | null;
276
+ 'deleteRootId'?: string | null;
247
277
  }
248
278
 
249
279
  export type Answer = {
@@ -258,6 +288,8 @@ export type Answer = {
258
288
  'deleted': boolean;
259
289
  'deletedAt': DateTime | null;
260
290
  'deletedById': string | null;
291
+ 'deleteRootType': string | null;
292
+ 'deleteRootId': string | null;
261
293
  }
262
294
 
263
295
  export type AnswerInitializer = {
@@ -279,6 +311,8 @@ export type AnswerSeed = {
279
311
  'deleted'?: boolean;
280
312
  'deletedAt'?: (DateTime | string) | null;
281
313
  'deletedById'?: string | null;
314
+ 'deleteRootType'?: string | null;
315
+ 'deleteRootId'?: string | null;
282
316
  }
283
317
 
284
318
  export type SeedData = {
@@ -101,6 +101,16 @@
101
101
  "reverse": "deletedAnotherObjects",
102
102
  "generated": true,
103
103
  "foreignKey": "deletedById"
104
+ },
105
+ {
106
+ "name": "deleteRootType",
107
+ "type": "String",
108
+ "generated": true
109
+ },
110
+ {
111
+ "name": "deleteRootId",
112
+ "type": "ID",
113
+ "generated": true
104
114
  }
105
115
  ]
106
116
  },
@@ -224,6 +234,16 @@
224
234
  "reverse": "deletedManyObjects",
225
235
  "generated": true,
226
236
  "foreignKey": "deletedById"
237
+ },
238
+ {
239
+ "name": "deleteRootType",
240
+ "type": "String",
241
+ "generated": true
242
+ },
243
+ {
244
+ "name": "deleteRootId",
245
+ "type": "ID",
246
+ "generated": true
227
247
  }
228
248
  ]
229
249
  },
@@ -320,6 +340,16 @@
320
340
  "reverse": "deletedReactions",
321
341
  "generated": true,
322
342
  "foreignKey": "deletedById"
343
+ },
344
+ {
345
+ "name": "deleteRootType",
346
+ "type": "String",
347
+ "generated": true
348
+ },
349
+ {
350
+ "name": "deleteRootId",
351
+ "type": "ID",
352
+ "generated": true
323
353
  }
324
354
  ]
325
355
  },
@@ -423,6 +453,18 @@
423
453
  "foreignKey": "deletedById",
424
454
  "inherited": true
425
455
  },
456
+ {
457
+ "name": "deleteRootType",
458
+ "type": "String",
459
+ "generated": true,
460
+ "inherited": true
461
+ },
462
+ {
463
+ "name": "deleteRootId",
464
+ "type": "ID",
465
+ "generated": true,
466
+ "inherited": true
467
+ },
426
468
  {
427
469
  "name": "rating",
428
470
  "type": "Float",
@@ -536,6 +578,18 @@
536
578
  "generated": true,
537
579
  "foreignKey": "deletedById",
538
580
  "inherited": true
581
+ },
582
+ {
583
+ "name": "deleteRootType",
584
+ "type": "String",
585
+ "generated": true,
586
+ "inherited": true
587
+ },
588
+ {
589
+ "name": "deleteRootId",
590
+ "type": "ID",
591
+ "generated": true,
592
+ "inherited": true
539
593
  }
540
594
  ],
541
595
  "queriable": true,
@@ -643,6 +697,18 @@
643
697
  "generated": true,
644
698
  "foreignKey": "deletedById",
645
699
  "inherited": true
700
+ },
701
+ {
702
+ "name": "deleteRootType",
703
+ "type": "String",
704
+ "generated": true,
705
+ "inherited": true
706
+ },
707
+ {
708
+ "name": "deleteRootId",
709
+ "type": "ID",
710
+ "generated": true,
711
+ "inherited": true
646
712
  }
647
713
  ],
648
714
  "queriable": true,
@@ -5,6 +5,8 @@ type AnotherObject {
5
5
  deleted: Boolean!
6
6
  deletedAt: DateTime
7
7
  deletedBy: User
8
+ deleteRootType: String
9
+ deleteRootId: ID
8
10
  self(where: AnotherObjectWhere, orderBy: [AnotherObjectOrderBy!], limit: Int, offset: Int): AnotherObject
9
11
  manyObjects(where: SomeObjectWhere, search: String, orderBy: [SomeObjectOrderBy!], limit: Int, offset: Int): [SomeObject!]!
10
12
  }
@@ -40,6 +42,8 @@ type Answer implements Reaction {
40
42
  deleted: Boolean!
41
43
  deletedAt: DateTime
42
44
  deletedBy: User
45
+ deleteRootType: String
46
+ deleteRootId: ID
43
47
  childReactions(where: ReactionWhere, orderBy: [ReactionOrderBy!], limit: Int, offset: Int): [Reaction!]!
44
48
  childReviews(where: ReviewWhere, orderBy: [ReviewOrderBy!], limit: Int, offset: Int): [Review!]!
45
49
  childQuestions(where: QuestionWhere, orderBy: [QuestionOrderBy!], limit: Int, offset: Int): [Question!]!
@@ -136,6 +140,8 @@ type Question implements Reaction {
136
140
  deleted: Boolean!
137
141
  deletedAt: DateTime
138
142
  deletedBy: User
143
+ deleteRootType: String
144
+ deleteRootId: ID
139
145
  childReactions(where: ReactionWhere, orderBy: [ReactionOrderBy!], limit: Int, offset: Int): [Reaction!]!
140
146
  childReviews(where: ReviewWhere, orderBy: [ReviewOrderBy!], limit: Int, offset: Int): [Review!]!
141
147
  childQuestions(where: QuestionWhere, orderBy: [QuestionOrderBy!], limit: Int, offset: Int): [Question!]!
@@ -172,6 +178,8 @@ interface Reaction {
172
178
  deleted: Boolean!
173
179
  deletedAt: DateTime
174
180
  deletedBy: User
181
+ deleteRootType: String
182
+ deleteRootId: ID
175
183
  childReactions(where: ReactionWhere, orderBy: [ReactionOrderBy!], limit: Int, offset: Int): [Reaction!]!
176
184
  childReviews(where: ReviewWhere, orderBy: [ReviewOrderBy!], limit: Int, offset: Int): [Review!]!
177
185
  childQuestions(where: QuestionWhere, orderBy: [QuestionOrderBy!], limit: Int, offset: Int): [Question!]!
@@ -214,6 +222,8 @@ type Review implements Reaction {
214
222
  deleted: Boolean!
215
223
  deletedAt: DateTime
216
224
  deletedBy: User
225
+ deleteRootType: String
226
+ deleteRootId: ID
217
227
  rating: Float
218
228
  childReactions(where: ReactionWhere, orderBy: [ReactionOrderBy!], limit: Int, offset: Int): [Reaction!]!
219
229
  childReviews(where: ReviewWhere, orderBy: [ReviewOrderBy!], limit: Int, offset: Int): [Review!]!
@@ -268,6 +278,8 @@ type SomeObject {
268
278
  deleted: Boolean!
269
279
  deletedAt: DateTime
270
280
  deletedBy: User
281
+ deleteRootType: String
282
+ deleteRootId: ID
271
283
  }
272
284
 
273
285
  input SomeObjectOrderBy {