@quesmed/types 2.6.29 → 2.6.30

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.
Files changed (43) hide show
  1. package/dist/cjs/resolvers/fragments/chapter.js +3 -18
  2. package/dist/cjs/resolvers/fragments/concept.d.ts +1 -2
  3. package/dist/cjs/resolvers/fragments/concept.js +18 -57
  4. package/dist/cjs/resolvers/fragments/index.d.ts +1 -0
  5. package/dist/cjs/resolvers/fragments/index.js +1 -0
  6. package/dist/cjs/resolvers/fragments/marksheet.d.ts +14 -0
  7. package/dist/cjs/resolvers/fragments/marksheet.js +127 -127
  8. package/dist/cjs/resolvers/fragments/osce.d.ts +1 -0
  9. package/dist/cjs/resolvers/fragments/osce.js +6 -1
  10. package/dist/cjs/resolvers/fragments/question.d.ts +5 -0
  11. package/dist/cjs/resolvers/fragments/question.js +176 -0
  12. package/dist/cjs/resolvers/fragments/topic.d.ts +2 -0
  13. package/dist/cjs/resolvers/fragments/topic.js +25 -1
  14. package/dist/cjs/resolvers/fragments/video.d.ts +1 -0
  15. package/dist/cjs/resolvers/fragments/video.js +17 -28
  16. package/dist/cjs/resolvers/mutation/restricted/marksheet.d.ts +0 -8
  17. package/dist/cjs/resolvers/mutation/restricted/marksheet.js +18 -4128
  18. package/dist/cjs/resolvers/mutation/restricted/questionDiscussion.d.ts +6 -21
  19. package/dist/cjs/resolvers/mutation/restricted/questionDiscussion.js +27 -532
  20. package/dist/cjs/resolvers/query/restricted/marksheet.js +5 -2025
  21. package/dist/cjs/resolvers/query/restricted/question.js +3 -932
  22. package/dist/mjs/resolvers/fragments/chapter.js +3 -18
  23. package/dist/mjs/resolvers/fragments/concept.d.ts +1 -2
  24. package/dist/mjs/resolvers/fragments/concept.js +18 -57
  25. package/dist/mjs/resolvers/fragments/index.d.ts +1 -0
  26. package/dist/mjs/resolvers/fragments/index.js +1 -0
  27. package/dist/mjs/resolvers/fragments/marksheet.d.ts +14 -0
  28. package/dist/mjs/resolvers/fragments/marksheet.js +126 -126
  29. package/dist/mjs/resolvers/fragments/osce.d.ts +1 -0
  30. package/dist/mjs/resolvers/fragments/osce.js +5 -0
  31. package/dist/mjs/resolvers/fragments/question.d.ts +5 -0
  32. package/dist/mjs/resolvers/fragments/question.js +173 -0
  33. package/dist/mjs/resolvers/fragments/topic.d.ts +2 -0
  34. package/dist/mjs/resolvers/fragments/topic.js +24 -0
  35. package/dist/mjs/resolvers/fragments/video.d.ts +1 -0
  36. package/dist/mjs/resolvers/fragments/video.js +16 -27
  37. package/dist/mjs/resolvers/mutation/restricted/marksheet.d.ts +0 -8
  38. package/dist/mjs/resolvers/mutation/restricted/marksheet.js +14 -4124
  39. package/dist/mjs/resolvers/mutation/restricted/questionDiscussion.d.ts +6 -21
  40. package/dist/mjs/resolvers/mutation/restricted/questionDiscussion.js +26 -530
  41. package/dist/mjs/resolvers/query/restricted/marksheet.js +5 -2025
  42. package/dist/mjs/resolvers/query/restricted/question.js +3 -932
  43. package/package.json +6 -1
@@ -1,4 +1,4 @@
1
- import { ApolloCache, DocumentNode } from '@apollo/client';
1
+ import { ApolloCache } from '@apollo/client';
2
2
  import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
3
3
  import { EQuestionLike, EQuestionType, IHighlight, IQuestion, IQuestionComment, IQuestionHighlights, Id } from '../../../models';
4
4
  import { RestrictedData, graphqlNormalize } from '../../types';
@@ -7,24 +7,9 @@ interface LikeData {
7
7
  dislikes?: number;
8
8
  isLikedByMe?: EQuestionLike;
9
9
  }
10
- export declare const QUESTION_SBA_COMMENT_FIELDS: DocumentNode;
11
- export declare const QUESTION_QA_COMMENT_FIELDS: DocumentNode;
12
- export declare const QUESTION_EMQ_COMMENT_FIELDS: DocumentNode;
13
- export declare const QUESTION_SELECT3_COMMENT_FIELDS: DocumentNode;
14
- export declare const QUESTION_RANKING_COMMENT_FIELDS: DocumentNode;
15
- export declare const QUESTION_QA_HIGHLIGHT_FIELDS: DocumentNode;
16
- export declare const QUESTION_SBA_HIGHLIGHT_FIELDS: DocumentNode;
17
- export declare const QUESTION_MULTIA_HIGHLIGHT_FIELDS: DocumentNode;
18
- export declare const QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS: DocumentNode;
19
- export declare const QUESTION_EMQ_HIGHLIGHT_FIELDS: DocumentNode;
20
- export declare const QUESTION_SELECT3_HIGHLIGHT_FIELDS: DocumentNode;
21
- export declare const QUESTION_RANKING_HIGHLIGHT_FIELDS: DocumentNode;
22
- export declare const QUESTION_MULTIA_COMMENT_FIELDS: DocumentNode;
23
- export declare const QUESTION_PRESCRIPTION_COMMENT_FIELDS: DocumentNode;
24
10
  export declare const getLikeData: (like: EQuestionLike, item: LikeData) => LikeData;
25
- export declare const getQuestionHighlightsFragment: (typeId: EQuestionType) => DocumentNode;
26
11
  export declare const getQuestionTypeName: (typeId: EQuestionType) => string;
27
- export declare const QUESTION_LIKE: DocumentNode;
12
+ export declare const QUESTION_LIKE: import("@apollo/client").DocumentNode;
28
13
  export declare const optimisticQuestionLike: (input: IQuestionLikeVar, question: IQuestion) => IQuestionLikeData;
29
14
  export interface IQuestionLikeVar {
30
15
  marksheetId?: Id;
@@ -32,7 +17,7 @@ export interface IQuestionLikeVar {
32
17
  like: EQuestionLike;
33
18
  }
34
19
  export type IQuestionLikeData = RestrictedData<graphqlNormalize & IQuestion, 'questionLike'>;
35
- export declare const QUESTION_COMMENTS: DocumentNode;
20
+ export declare const QUESTION_COMMENTS: import("@apollo/client").DocumentNode;
36
21
  export declare const updateQuestionComments: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IQuestionCommentsData>, options: ApolloUpdateOptions) => void;
37
22
  export declare const optimisticQuestionComment: (id: number, user: {
38
23
  id: number;
@@ -45,7 +30,7 @@ export interface IQuestionCommentsVar {
45
30
  comment: string;
46
31
  }
47
32
  export type IQuestionCommentsData = RestrictedData<graphqlNormalize & IQuestionComment, 'questionComments'>;
48
- export declare const QUESTION_COMMENT_LIKE: DocumentNode;
33
+ export declare const QUESTION_COMMENT_LIKE: import("@apollo/client").DocumentNode;
49
34
  export declare const optimisticCommentLike: (comments: IQuestionComment[], input: IQuestionCommentsLikeVar, parentId: number | null) => IQuestionCommentsLikeData;
50
35
  export interface IQuestionCommentsLikeVar {
51
36
  marksheetId?: Id;
@@ -54,7 +39,7 @@ export interface IQuestionCommentsLikeVar {
54
39
  like: EQuestionLike;
55
40
  }
56
41
  export type IQuestionCommentsLikeData = RestrictedData<graphqlNormalize & IQuestionComment, 'questionCommentLike'>;
57
- export declare const QUESTION_COMMENT_REMOVE: DocumentNode;
42
+ export declare const QUESTION_COMMENT_REMOVE: import("@apollo/client").DocumentNode;
58
43
  export declare const updateQuestionCommentsRemove: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IQuestionCommentRemoveData>, options: ApolloUpdateOptions) => void;
59
44
  export declare const optimisticQuestionCommentRemove: (comments: IQuestionComment[], input: IQuestionCommentRemoveVar, parentId?: number) => IQuestionCommentRemoveData;
60
45
  export interface IQuestionCommentRemoveVar {
@@ -73,6 +58,6 @@ export interface IAddQuestionHighlightVar {
73
58
  }[];
74
59
  }
75
60
  export type IAddQuestionHighlightData = RestrictedData<(graphqlNormalize & IQuestionHighlights)[], 'addQuestionHighlight'>;
76
- export declare const ADD_QUESTION_HIGHLIGHT: DocumentNode;
61
+ export declare const ADD_QUESTION_HIGHLIGHT: import("@apollo/client").DocumentNode;
77
62
  export declare const updateQuestionHighlights: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionHighlightData>, options: ApolloUpdateOptions) => void;
78
63
  export {};
@@ -1,401 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateQuestionHighlights = exports.ADD_QUESTION_HIGHLIGHT = exports.optimisticQuestionCommentRemove = exports.updateQuestionCommentsRemove = exports.QUESTION_COMMENT_REMOVE = exports.optimisticCommentLike = exports.QUESTION_COMMENT_LIKE = exports.optimisticQuestionComment = exports.updateQuestionComments = exports.QUESTION_COMMENTS = exports.optimisticQuestionLike = exports.QUESTION_LIKE = exports.getQuestionTypeName = exports.getQuestionHighlightsFragment = exports.getLikeData = exports.QUESTION_PRESCRIPTION_COMMENT_FIELDS = exports.QUESTION_MULTIA_COMMENT_FIELDS = exports.QUESTION_RANKING_HIGHLIGHT_FIELDS = exports.QUESTION_SELECT3_HIGHLIGHT_FIELDS = exports.QUESTION_EMQ_HIGHLIGHT_FIELDS = exports.QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS = exports.QUESTION_MULTIA_HIGHLIGHT_FIELDS = exports.QUESTION_SBA_HIGHLIGHT_FIELDS = exports.QUESTION_QA_HIGHLIGHT_FIELDS = exports.QUESTION_RANKING_COMMENT_FIELDS = exports.QUESTION_SELECT3_COMMENT_FIELDS = exports.QUESTION_EMQ_COMMENT_FIELDS = exports.QUESTION_QA_COMMENT_FIELDS = exports.QUESTION_SBA_COMMENT_FIELDS = void 0;
3
+ exports.updateQuestionHighlights = exports.ADD_QUESTION_HIGHLIGHT = exports.optimisticQuestionCommentRemove = exports.updateQuestionCommentsRemove = exports.QUESTION_COMMENT_REMOVE = exports.optimisticCommentLike = exports.QUESTION_COMMENT_LIKE = exports.optimisticQuestionComment = exports.updateQuestionComments = exports.QUESTION_COMMENTS = exports.optimisticQuestionLike = exports.QUESTION_LIKE = exports.getQuestionTypeName = exports.getLikeData = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const luxon_1 = require("luxon");
6
6
  const models_1 = require("../../../models");
7
- exports.QUESTION_SBA_COMMENT_FIELDS = (0, client_1.gql) `
8
- fragment QuestionSBAComments on QuestionSBA {
9
- id
10
- likes
11
- dislikes
12
- isLikedByMe
13
- highlights {
14
- start
15
- end
16
- text
17
- part
18
- tag
19
- color
20
- }
21
- comments {
22
- id
23
- createdAt
24
- comment
25
- parentId
26
- likes
27
- user {
28
- id
29
- displayName
30
- }
31
- dislikes
32
- isLikedByMe
33
- questionId
34
- replies {
35
- id
36
- createdAt
37
- comment
38
- parentId
39
- user {
40
- id
41
- displayName
42
- }
43
- likes
44
- dislikes
45
- isLikedByMe
46
- questionId
47
- }
48
- }
49
- }
50
- `;
51
- exports.QUESTION_QA_COMMENT_FIELDS = (0, client_1.gql) `
52
- fragment QuestionQAComments on QuestionQA {
53
- id
54
- likes
55
- dislikes
56
- isLikedByMe
57
- highlights {
58
- start
59
- end
60
- text
61
- part
62
- tag
63
- color
64
- }
65
- comments {
66
- id
67
- createdAt
68
- comment
69
- parentId
70
- likes
71
- user {
72
- id
73
- displayName
74
- }
75
- dislikes
76
- isLikedByMe
77
- questionId
78
- replies {
79
- id
80
- createdAt
81
- comment
82
- parentId
83
- user {
84
- id
85
- displayName
86
- }
87
- likes
88
- dislikes
89
- isLikedByMe
90
- questionId
91
- }
92
- }
93
- }
94
- `;
95
- exports.QUESTION_EMQ_COMMENT_FIELDS = (0, client_1.gql) `
96
- fragment QuestionEMQComments on QuestionEMQ {
97
- id
98
- likes
99
- dislikes
100
- isLikedByMe
101
- highlights {
102
- start
103
- end
104
- text
105
- part
106
- tag
107
- color
108
- }
109
- comments {
110
- id
111
- createdAt
112
- comment
113
- parentId
114
- likes
115
- user {
116
- id
117
- displayName
118
- }
119
- dislikes
120
- isLikedByMe
121
- questionId
122
- replies {
123
- id
124
- createdAt
125
- comment
126
- parentId
127
- user {
128
- id
129
- displayName
130
- }
131
- likes
132
- dislikes
133
- isLikedByMe
134
- questionId
135
- }
136
- }
137
- }
138
- `;
139
- exports.QUESTION_SELECT3_COMMENT_FIELDS = (0, client_1.gql) `
140
- fragment QuestionSelect3Comments on QuestionSelect3 {
141
- id
142
- likes
143
- dislikes
144
- isLikedByMe
145
- highlights {
146
- start
147
- end
148
- text
149
- part
150
- tag
151
- color
152
- }
153
- comments {
154
- id
155
- createdAt
156
- comment
157
- parentId
158
- likes
159
- user {
160
- id
161
- displayName
162
- }
163
- dislikes
164
- isLikedByMe
165
- questionId
166
- replies {
167
- id
168
- createdAt
169
- comment
170
- parentId
171
- user {
172
- id
173
- displayName
174
- }
175
- likes
176
- dislikes
177
- isLikedByMe
178
- questionId
179
- }
180
- }
181
- }
182
- `;
183
- exports.QUESTION_RANKING_COMMENT_FIELDS = (0, client_1.gql) `
184
- fragment QuestionRankingComments on QuestionRanking {
185
- id
186
- likes
187
- dislikes
188
- isLikedByMe
189
- highlights {
190
- start
191
- end
192
- text
193
- part
194
- tag
195
- color
196
- }
197
- comments {
198
- id
199
- createdAt
200
- comment
201
- parentId
202
- likes
203
- user {
204
- id
205
- displayName
206
- }
207
- dislikes
208
- isLikedByMe
209
- questionId
210
- replies {
211
- id
212
- createdAt
213
- comment
214
- parentId
215
- user {
216
- id
217
- displayName
218
- }
219
- likes
220
- dislikes
221
- isLikedByMe
222
- questionId
223
- }
224
- }
225
- }
226
- `;
227
- exports.QUESTION_QA_HIGHLIGHT_FIELDS = (0, client_1.gql) `
228
- fragment QuestionQAHighlights on QuestionQA {
229
- highlights {
230
- start
231
- end
232
- text
233
- part
234
- tag
235
- color
236
- }
237
- }
238
- `;
239
- exports.QUESTION_SBA_HIGHLIGHT_FIELDS = (0, client_1.gql) `
240
- fragment QuestionSBAHighlights on QuestionSBA {
241
- highlights {
242
- start
243
- end
244
- text
245
- part
246
- tag
247
- color
248
- }
249
- }
250
- `;
251
- exports.QUESTION_MULTIA_HIGHLIGHT_FIELDS = (0, client_1.gql) `
252
- fragment QuestionMultiAHighlights on QuestionMultiA {
253
- highlights {
254
- start
255
- end
256
- text
257
- part
258
- tag
259
- color
260
- }
261
- }
262
- `;
263
- exports.QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS = (0, client_1.gql) `
264
- fragment QuestionPrescriptionHighlights on QuestionPrescription {
265
- highlights {
266
- start
267
- end
268
- text
269
- part
270
- tag
271
- color
272
- }
273
- }
274
- `;
275
- exports.QUESTION_EMQ_HIGHLIGHT_FIELDS = (0, client_1.gql) `
276
- fragment QuestionMultiAHighlights on QuestionMultiA {
277
- highlights {
278
- start
279
- end
280
- text
281
- part
282
- tag
283
- color
284
- }
285
- }
286
- `;
287
- exports.QUESTION_SELECT3_HIGHLIGHT_FIELDS = (0, client_1.gql) `
288
- fragment QuestionMultiAHighlights on QuestionMultiA {
289
- highlights {
290
- start
291
- end
292
- text
293
- part
294
- tag
295
- color
296
- }
297
- }
298
- `;
299
- exports.QUESTION_RANKING_HIGHLIGHT_FIELDS = (0, client_1.gql) `
300
- fragment QuestionMultiAHighlights on QuestionMultiA {
301
- highlights {
302
- start
303
- end
304
- text
305
- part
306
- tag
307
- color
308
- }
309
- }
310
- `;
311
- exports.QUESTION_MULTIA_COMMENT_FIELDS = (0, client_1.gql) `
312
- fragment QuestionMultiAComments on QuestionMultiA {
313
- id
314
- likes
315
- dislikes
316
- isLikedByMe
317
- highlights {
318
- start
319
- end
320
- text
321
- part
322
- tag
323
- color
324
- }
325
- comments {
326
- id
327
- createdAt
328
- comment
329
- parentId
330
- likes
331
- user {
332
- id
333
- displayName
334
- }
335
- dislikes
336
- isLikedByMe
337
- questionId
338
- replies {
339
- id
340
- createdAt
341
- comment
342
- parentId
343
- user {
344
- id
345
- displayName
346
- }
347
- likes
348
- dislikes
349
- isLikedByMe
350
- questionId
351
- }
352
- }
353
- }
354
- `;
355
- exports.QUESTION_PRESCRIPTION_COMMENT_FIELDS = (0, client_1.gql) `
356
- fragment QuestionPrescriptionComments on QuestionPrescription {
357
- id
358
- likes
359
- dislikes
360
- isLikedByMe
361
- highlights {
362
- start
363
- end
364
- text
365
- part
366
- tag
367
- color
368
- }
369
- comments {
370
- id
371
- createdAt
372
- comment
373
- parentId
374
- likes
375
- user {
376
- id
377
- displayName
378
- }
379
- dislikes
380
- isLikedByMe
381
- questionId
382
- replies {
383
- id
384
- createdAt
385
- comment
386
- parentId
387
- user {
388
- id
389
- displayName
390
- }
391
- likes
392
- dislikes
393
- isLikedByMe
394
- questionId
395
- }
396
- }
397
- }
398
- `;
7
+ const fragments_1 = require("../../fragments");
399
8
  const getLikeData = (like, item) => {
400
9
  let { likes = 0, dislikes = 0, isLikedByMe } = item;
401
10
  if (isLikedByMe === models_1.EQuestionLike.LIKE) {
@@ -421,65 +30,19 @@ const getLikeData = (like, item) => {
421
30
  return { likes, dislikes, isLikedByMe: like };
422
31
  };
423
32
  exports.getLikeData = getLikeData;
424
- const getQuestionHighlightsFragment = (typeId) => {
425
- switch (typeId) {
426
- case models_1.EQuestionType.QUESTION_ANSWER:
427
- return exports.QUESTION_QA_HIGHLIGHT_FIELDS;
428
- case models_1.EQuestionType.PRESCRIPTION_ANSWER:
429
- return exports.QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS;
430
- case models_1.EQuestionType.MULTIPLE_ANSWERS:
431
- return exports.QUESTION_MULTIA_HIGHLIGHT_FIELDS;
432
- case models_1.EQuestionType.EXTENDED_MATCHING_ANSWER:
433
- return exports.QUESTION_EMQ_HIGHLIGHT_FIELDS;
434
- case models_1.EQuestionType.SELECT_THREE_ANSWER:
435
- return exports.QUESTION_SELECT3_HIGHLIGHT_FIELDS;
436
- case models_1.EQuestionType.RANKING_ANSWER:
437
- return exports.QUESTION_RANKING_HIGHLIGHT_FIELDS;
438
- case models_1.EQuestionType.SINGLE_BEST_ANSWER:
439
- default:
440
- return exports.QUESTION_SBA_HIGHLIGHT_FIELDS;
441
- }
442
- };
443
- exports.getQuestionHighlightsFragment = getQuestionHighlightsFragment;
444
33
  const getQuestionTypeName = (typeId) => {
445
- switch (typeId) {
446
- case models_1.EQuestionType.QUESTION_ANSWER:
447
- return 'QuestionQA';
448
- case models_1.EQuestionType.PRESCRIPTION_ANSWER:
449
- return 'QuestionPrescription';
450
- case models_1.EQuestionType.MULTIPLE_ANSWERS:
451
- return 'QuestionMultiA';
452
- case models_1.EQuestionType.EXTENDED_MATCHING_ANSWER:
453
- return 'QuestionEMQ';
454
- case models_1.EQuestionType.SELECT_THREE_ANSWER:
455
- return 'QuestionSelect3';
456
- case models_1.EQuestionType.RANKING_ANSWER:
457
- return 'QuestionRanking';
458
- case models_1.EQuestionType.SINGLE_BEST_ANSWER:
459
- default:
460
- return 'QuestionSBA';
461
- }
34
+ const mappedObj = {
35
+ [models_1.EQuestionType.SINGLE_BEST_ANSWER]: 'QuestionSBA',
36
+ [models_1.EQuestionType.QUESTION_ANSWER]: 'QuestionQA',
37
+ [models_1.EQuestionType.MULTIPLE_ANSWERS]: 'QuestionMultiA',
38
+ [models_1.EQuestionType.PRESCRIPTION_ANSWER]: 'QuestionPrescription',
39
+ [models_1.EQuestionType.EXTENDED_MATCHING_ANSWER]: 'QuestionEMQ',
40
+ [models_1.EQuestionType.RANKING_ANSWER]: 'QuestionRanking',
41
+ [models_1.EQuestionType.SELECT_THREE_ANSWER]: 'QuestionSelect3',
42
+ };
43
+ return mappedObj[typeId] ?? 'QuestionSBA';
462
44
  };
463
45
  exports.getQuestionTypeName = getQuestionTypeName;
464
- const getQuestionFragment = (typeId) => {
465
- switch (typeId) {
466
- case models_1.EQuestionType.QUESTION_ANSWER:
467
- return exports.QUESTION_QA_COMMENT_FIELDS;
468
- case models_1.EQuestionType.PRESCRIPTION_ANSWER:
469
- return exports.QUESTION_PRESCRIPTION_COMMENT_FIELDS;
470
- case models_1.EQuestionType.MULTIPLE_ANSWERS:
471
- return exports.QUESTION_MULTIA_COMMENT_FIELDS;
472
- case models_1.EQuestionType.EXTENDED_MATCHING_ANSWER:
473
- return exports.QUESTION_EMQ_COMMENT_FIELDS;
474
- case models_1.EQuestionType.SELECT_THREE_ANSWER:
475
- return exports.QUESTION_SELECT3_COMMENT_FIELDS;
476
- case models_1.EQuestionType.RANKING_ANSWER:
477
- return exports.QUESTION_RANKING_COMMENT_FIELDS;
478
- case models_1.EQuestionType.SINGLE_BEST_ANSWER:
479
- default:
480
- return exports.QUESTION_SBA_COMMENT_FIELDS;
481
- }
482
- };
483
46
  const addCommentToDiscussion = (newComment, comments, parentId) => {
484
47
  if (parentId) {
485
48
  const commentIndex = comments.findIndex(({ id }) => Number(id) === parentId);
@@ -559,6 +122,7 @@ const optimisticQuestionLike = (input, question) => {
559
122
  };
560
123
  exports.optimisticQuestionLike = optimisticQuestionLike;
561
124
  exports.QUESTION_COMMENTS = (0, client_1.gql) `
125
+ ${fragments_1.QUESTION_COMMENT_FIELDS}
562
126
  mutation QuestionComments(
563
127
  $marksheetId: Int
564
128
  $questionId: Int!
@@ -572,32 +136,7 @@ exports.QUESTION_COMMENTS = (0, client_1.gql) `
572
136
  parentId: $parentId
573
137
  comment: $comment
574
138
  ) {
575
- id
576
- createdAt
577
- comment
578
- parentId
579
- user {
580
- id
581
- displayName
582
- }
583
- likes
584
- dislikes
585
- isLikedByMe
586
- questionId
587
- replies {
588
- id
589
- createdAt
590
- comment
591
- parentId
592
- user {
593
- id
594
- displayName
595
- }
596
- likes
597
- dislikes
598
- isLikedByMe
599
- questionId
600
- }
139
+ ...QuestionCommentFields
601
140
  }
602
141
  }
603
142
  }
@@ -615,7 +154,8 @@ const updateQuestionComments = (typeId) => (cache, result, options) => {
615
154
  id: questionId,
616
155
  __typename: (0, exports.getQuestionTypeName)(typeId),
617
156
  }),
618
- fragment: getQuestionFragment(typeId),
157
+ fragment: fragments_1.QUESTION_WITH_COMMENT_FIELDS,
158
+ fragmentName: 'QuestionWithCommentFields',
619
159
  });
620
160
  if (dataFragment) {
621
161
  const { comments = [] } = dataFragment;
@@ -628,7 +168,8 @@ const updateQuestionComments = (typeId) => (cache, result, options) => {
628
168
  ...dataFragment,
629
169
  comments: addCommentToDiscussion(questionComments, comments, parentId),
630
170
  },
631
- fragment: getQuestionFragment(typeId),
171
+ fragment: fragments_1.QUESTION_WITH_COMMENT_FIELDS,
172
+ fragmentName: 'QuestionWithCommentFields',
632
173
  });
633
174
  }
634
175
  }
@@ -663,6 +204,7 @@ const optimisticQuestionComment = (id, user, input) => {
663
204
  };
664
205
  exports.optimisticQuestionComment = optimisticQuestionComment;
665
206
  exports.QUESTION_COMMENT_LIKE = (0, client_1.gql) `
207
+ ${fragments_1.QUESTION_COMMENT_FIELDS}
666
208
  mutation QuestionCommentLike(
667
209
  $marksheetId: Int
668
210
  $questionId: Int!
@@ -676,32 +218,7 @@ exports.QUESTION_COMMENT_LIKE = (0, client_1.gql) `
676
218
  commentId: $commentId
677
219
  like: $like
678
220
  ) {
679
- id
680
- createdAt
681
- comment
682
- parentId
683
- user {
684
- id
685
- displayName
686
- }
687
- likes
688
- dislikes
689
- isLikedByMe
690
- questionId
691
- replies {
692
- id
693
- createdAt
694
- comment
695
- parentId
696
- user {
697
- id
698
- displayName
699
- }
700
- likes
701
- dislikes
702
- isLikedByMe
703
- questionId
704
- }
221
+ ...QuestionCommentFields
705
222
  }
706
223
  }
707
224
  }
@@ -727,6 +244,7 @@ const optimisticCommentLike = (comments, input, parentId) => {
727
244
  };
728
245
  exports.optimisticCommentLike = optimisticCommentLike;
729
246
  exports.QUESTION_COMMENT_REMOVE = (0, client_1.gql) `
247
+ ${fragments_1.QUESTION_COMMENT_FIELDS}
730
248
  mutation QuestionCommentRemove(
731
249
  $marksheetId: Int
732
250
  $questionId: Int!
@@ -738,32 +256,7 @@ exports.QUESTION_COMMENT_REMOVE = (0, client_1.gql) `
738
256
  questionId: $questionId
739
257
  commentId: $commentId
740
258
  ) {
741
- id
742
- createdAt
743
- comment
744
- parentId
745
- user {
746
- id
747
- displayName
748
- }
749
- likes
750
- dislikes
751
- isLikedByMe
752
- questionId
753
- replies {
754
- id
755
- createdAt
756
- comment
757
- parentId
758
- user {
759
- id
760
- displayName
761
- }
762
- likes
763
- dislikes
764
- isLikedByMe
765
- questionId
766
- }
259
+ ...QuestionCommentFields
767
260
  }
768
261
  }
769
262
  }
@@ -781,7 +274,8 @@ const updateQuestionCommentsRemove = (typeId) => (cache, result, options) => {
781
274
  id: questionId,
782
275
  __typename: (0, exports.getQuestionTypeName)(typeId),
783
276
  }),
784
- fragment: getQuestionFragment(typeId),
277
+ fragment: fragments_1.QUESTION_WITH_COMMENT_FIELDS,
278
+ fragmentName: 'QuestionWithCommentFields',
785
279
  });
786
280
  if (dataFragment) {
787
281
  const { comments = [] } = dataFragment;
@@ -803,7 +297,8 @@ const updateQuestionCommentsRemove = (typeId) => (cache, result, options) => {
803
297
  ...dataFragment,
804
298
  comments: updatedComments,
805
299
  },
806
- fragment: getQuestionFragment(typeId),
300
+ fragment: fragments_1.QUESTION_WITH_COMMENT_FIELDS,
301
+ fragmentName: 'QuestionWithCommentFields',
807
302
  });
808
303
  }
809
304
  }
@@ -875,7 +370,7 @@ const updateQuestionHighlights = (typeId) => (cache, result, options) => {
875
370
  data: {
876
371
  highlights: addQuestionHighlight[0].highlights,
877
372
  },
878
- fragment: (0, exports.getQuestionHighlightsFragment)(typeId),
373
+ fragment: fragments_1.QUESTION_WITH_HIGHLIGHT_FIELDS,
879
374
  });
880
375
  });
881
376
  }