@quesmed/types-rn 2.4.10 → 2.4.12
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/models/Picture.d.ts +1 -0
- package/models/Question.d.ts +20 -0
- package/models/User.d.ts +2 -0
- package/package.json +1 -1
- package/resolvers/fragments/chapter.js +1 -0
- package/resolvers/fragments/marksheet.js +1 -0
- package/resolvers/fragments/picture.js +1 -0
- package/resolvers/mutation/restricted/marksheet.js +108 -0
- package/resolvers/mutation/restricted/questionDiscussion.d.ts +18 -1
- package/resolvers/mutation/restricted/questionDiscussion.js +140 -1
- package/resolvers/query/restricted/marksheet.js +117 -0
- package/resolvers/query/restricted/quesBook.js +1 -0
- package/resolvers/query/restricted/question.js +4 -0
- package/resolvers/query/restricted/todos.js +1 -0
- package/resolvers/query/restricted/video.js +2 -0
- package/resolvers/query/sample.js +2 -0
- package/resolvers/query/video.js +2 -0
- package/utils/lightgallery.js +25 -12
package/models/Picture.d.ts
CHANGED
package/models/Question.d.ts
CHANGED
|
@@ -79,6 +79,26 @@ export interface IQuestion {
|
|
|
79
79
|
dislikes?: number;
|
|
80
80
|
isLikedByMe?: EQuestionLike;
|
|
81
81
|
comments?: IQuestionComment[];
|
|
82
|
+
highlights?: Array<IHighlight>;
|
|
83
|
+
}
|
|
84
|
+
export interface IHighlight {
|
|
85
|
+
start: number;
|
|
86
|
+
end: number;
|
|
87
|
+
text: string;
|
|
88
|
+
color?: string;
|
|
89
|
+
part?: string;
|
|
90
|
+
tag?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface IQuestionHighlights {
|
|
93
|
+
id: Id;
|
|
94
|
+
createdAt: number | Date;
|
|
95
|
+
updatedAt: number | Date;
|
|
96
|
+
deletedAt: number | Date;
|
|
97
|
+
userId?: Id;
|
|
98
|
+
questionId?: Id;
|
|
99
|
+
user?: IUser;
|
|
100
|
+
question?: IQuestion;
|
|
101
|
+
highlights?: Array<IHighlight>;
|
|
82
102
|
}
|
|
83
103
|
export interface IQuestionChoice {
|
|
84
104
|
id: Id;
|
package/models/User.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ICard } from './Card';
|
|
2
2
|
import { IConcept } from './Concept';
|
|
3
3
|
import { IMarksheet, IMarksheetMark } from './Marksheet';
|
|
4
|
+
import { IQuestionHighlights } from './Question';
|
|
4
5
|
import { INotification } from './Notification';
|
|
5
6
|
import { IQuestion } from './Question';
|
|
6
7
|
import { ISubscription } from './Subscription';
|
|
@@ -93,6 +94,7 @@ export interface IUser {
|
|
|
93
94
|
qbankSubscriptionEndDate: number | Date | null;
|
|
94
95
|
osceSubscriptionEndDate: number | Date | null;
|
|
95
96
|
bundleSubscriptionEndDate: number | Date | null;
|
|
97
|
+
questionHighlights?: IQuestionHighlights[];
|
|
96
98
|
}
|
|
97
99
|
export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear, compareUnix?: number): IClassYear;
|
|
98
100
|
export declare function currentClassGroup(createdAtUnix: number, classYear: IClassYear): EClassYearGroup;
|
package/package.json
CHANGED
|
@@ -68,6 +68,14 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
|
|
|
68
68
|
question
|
|
69
69
|
totalVotes
|
|
70
70
|
typeId
|
|
71
|
+
highlights {
|
|
72
|
+
start
|
|
73
|
+
end
|
|
74
|
+
text
|
|
75
|
+
part
|
|
76
|
+
tag
|
|
77
|
+
color
|
|
78
|
+
}
|
|
71
79
|
choices {
|
|
72
80
|
id
|
|
73
81
|
explanation
|
|
@@ -129,6 +137,7 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
|
|
|
129
137
|
path
|
|
130
138
|
path512
|
|
131
139
|
path256
|
|
140
|
+
index
|
|
132
141
|
topicId
|
|
133
142
|
topic {
|
|
134
143
|
id
|
|
@@ -187,6 +196,14 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
|
|
|
187
196
|
question
|
|
188
197
|
totalVotes
|
|
189
198
|
typeId
|
|
199
|
+
highlights {
|
|
200
|
+
start
|
|
201
|
+
end
|
|
202
|
+
text
|
|
203
|
+
part
|
|
204
|
+
tag
|
|
205
|
+
color
|
|
206
|
+
}
|
|
190
207
|
choices {
|
|
191
208
|
id
|
|
192
209
|
explanation
|
|
@@ -248,6 +265,7 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
|
|
|
248
265
|
path
|
|
249
266
|
path512
|
|
250
267
|
path256
|
|
268
|
+
index
|
|
251
269
|
topicId
|
|
252
270
|
topic {
|
|
253
271
|
id
|
|
@@ -309,6 +327,14 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
|
|
|
309
327
|
question
|
|
310
328
|
totalVotes
|
|
311
329
|
typeId
|
|
330
|
+
highlights {
|
|
331
|
+
start
|
|
332
|
+
end
|
|
333
|
+
text
|
|
334
|
+
part
|
|
335
|
+
tag
|
|
336
|
+
color
|
|
337
|
+
}
|
|
312
338
|
choices {
|
|
313
339
|
id
|
|
314
340
|
explanation
|
|
@@ -370,6 +396,7 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
|
|
|
370
396
|
path
|
|
371
397
|
path512
|
|
372
398
|
path256
|
|
399
|
+
index
|
|
373
400
|
topicId
|
|
374
401
|
topic {
|
|
375
402
|
id
|
|
@@ -428,6 +455,14 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
|
|
|
428
455
|
question
|
|
429
456
|
totalVotes
|
|
430
457
|
typeId
|
|
458
|
+
highlights {
|
|
459
|
+
start
|
|
460
|
+
end
|
|
461
|
+
text
|
|
462
|
+
part
|
|
463
|
+
tag
|
|
464
|
+
color
|
|
465
|
+
}
|
|
431
466
|
choices {
|
|
432
467
|
id
|
|
433
468
|
explanation
|
|
@@ -489,6 +524,7 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
|
|
|
489
524
|
path
|
|
490
525
|
path512
|
|
491
526
|
path256
|
|
527
|
+
index
|
|
492
528
|
topicId
|
|
493
529
|
topic {
|
|
494
530
|
id
|
|
@@ -642,6 +678,14 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
642
678
|
question
|
|
643
679
|
totalVotes
|
|
644
680
|
typeId
|
|
681
|
+
highlights {
|
|
682
|
+
start
|
|
683
|
+
end
|
|
684
|
+
text
|
|
685
|
+
part
|
|
686
|
+
tag
|
|
687
|
+
color
|
|
688
|
+
}
|
|
645
689
|
choices {
|
|
646
690
|
id
|
|
647
691
|
explanation
|
|
@@ -703,6 +747,7 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
703
747
|
path
|
|
704
748
|
path512
|
|
705
749
|
path256
|
|
750
|
+
index
|
|
706
751
|
topicId
|
|
707
752
|
topic {
|
|
708
753
|
id
|
|
@@ -761,6 +806,14 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
761
806
|
question
|
|
762
807
|
totalVotes
|
|
763
808
|
typeId
|
|
809
|
+
highlights {
|
|
810
|
+
start
|
|
811
|
+
end
|
|
812
|
+
text
|
|
813
|
+
part
|
|
814
|
+
tag
|
|
815
|
+
color
|
|
816
|
+
}
|
|
764
817
|
choices {
|
|
765
818
|
id
|
|
766
819
|
explanation
|
|
@@ -822,6 +875,7 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
822
875
|
path
|
|
823
876
|
path512
|
|
824
877
|
path256
|
|
878
|
+
index
|
|
825
879
|
topicId
|
|
826
880
|
topic {
|
|
827
881
|
id
|
|
@@ -883,6 +937,14 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
883
937
|
question
|
|
884
938
|
totalVotes
|
|
885
939
|
typeId
|
|
940
|
+
highlights {
|
|
941
|
+
start
|
|
942
|
+
end
|
|
943
|
+
text
|
|
944
|
+
part
|
|
945
|
+
tag
|
|
946
|
+
color
|
|
947
|
+
}
|
|
886
948
|
choices {
|
|
887
949
|
id
|
|
888
950
|
explanation
|
|
@@ -944,6 +1006,7 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
944
1006
|
path
|
|
945
1007
|
path512
|
|
946
1008
|
path256
|
|
1009
|
+
index
|
|
947
1010
|
topicId
|
|
948
1011
|
topic {
|
|
949
1012
|
id
|
|
@@ -1002,6 +1065,14 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
1002
1065
|
question
|
|
1003
1066
|
totalVotes
|
|
1004
1067
|
typeId
|
|
1068
|
+
highlights {
|
|
1069
|
+
start
|
|
1070
|
+
end
|
|
1071
|
+
text
|
|
1072
|
+
part
|
|
1073
|
+
tag
|
|
1074
|
+
color
|
|
1075
|
+
}
|
|
1005
1076
|
choices {
|
|
1006
1077
|
id
|
|
1007
1078
|
explanation
|
|
@@ -1063,6 +1134,7 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
1063
1134
|
path
|
|
1064
1135
|
path512
|
|
1065
1136
|
path256
|
|
1137
|
+
index
|
|
1066
1138
|
topicId
|
|
1067
1139
|
topic {
|
|
1068
1140
|
id
|
|
@@ -1221,6 +1293,14 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
1221
1293
|
question
|
|
1222
1294
|
totalVotes
|
|
1223
1295
|
typeId
|
|
1296
|
+
highlights {
|
|
1297
|
+
start
|
|
1298
|
+
end
|
|
1299
|
+
text
|
|
1300
|
+
part
|
|
1301
|
+
tag
|
|
1302
|
+
color
|
|
1303
|
+
}
|
|
1224
1304
|
choices {
|
|
1225
1305
|
id
|
|
1226
1306
|
explanation
|
|
@@ -1282,6 +1362,7 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
1282
1362
|
path
|
|
1283
1363
|
path512
|
|
1284
1364
|
path256
|
|
1365
|
+
index
|
|
1285
1366
|
topicId
|
|
1286
1367
|
topic {
|
|
1287
1368
|
id
|
|
@@ -1340,6 +1421,14 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
1340
1421
|
question
|
|
1341
1422
|
totalVotes
|
|
1342
1423
|
typeId
|
|
1424
|
+
highlights {
|
|
1425
|
+
start
|
|
1426
|
+
end
|
|
1427
|
+
text
|
|
1428
|
+
part
|
|
1429
|
+
tag
|
|
1430
|
+
color
|
|
1431
|
+
}
|
|
1343
1432
|
choices {
|
|
1344
1433
|
id
|
|
1345
1434
|
explanation
|
|
@@ -1401,6 +1490,7 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
1401
1490
|
path
|
|
1402
1491
|
path512
|
|
1403
1492
|
path256
|
|
1493
|
+
index
|
|
1404
1494
|
topicId
|
|
1405
1495
|
topic {
|
|
1406
1496
|
id
|
|
@@ -1462,6 +1552,14 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
1462
1552
|
question
|
|
1463
1553
|
totalVotes
|
|
1464
1554
|
typeId
|
|
1555
|
+
highlights {
|
|
1556
|
+
start
|
|
1557
|
+
end
|
|
1558
|
+
text
|
|
1559
|
+
part
|
|
1560
|
+
tag
|
|
1561
|
+
color
|
|
1562
|
+
}
|
|
1465
1563
|
choices {
|
|
1466
1564
|
id
|
|
1467
1565
|
explanation
|
|
@@ -1523,6 +1621,7 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
1523
1621
|
path
|
|
1524
1622
|
path512
|
|
1525
1623
|
path256
|
|
1624
|
+
index
|
|
1526
1625
|
topicId
|
|
1527
1626
|
topic {
|
|
1528
1627
|
id
|
|
@@ -1581,6 +1680,14 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
1581
1680
|
question
|
|
1582
1681
|
totalVotes
|
|
1583
1682
|
typeId
|
|
1683
|
+
highlights {
|
|
1684
|
+
start
|
|
1685
|
+
end
|
|
1686
|
+
text
|
|
1687
|
+
part
|
|
1688
|
+
tag
|
|
1689
|
+
color
|
|
1690
|
+
}
|
|
1584
1691
|
choices {
|
|
1585
1692
|
id
|
|
1586
1693
|
explanation
|
|
@@ -1642,6 +1749,7 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
|
|
|
1642
1749
|
path
|
|
1643
1750
|
path512
|
|
1644
1751
|
path256
|
|
1752
|
+
index
|
|
1645
1753
|
topicId
|
|
1646
1754
|
topic {
|
|
1647
1755
|
id
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApolloCache, DocumentNode } from '@apollo/client';
|
|
2
2
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
|
|
3
|
-
import { EQuestionLike, EQuestionType, Id, IQuestion, IQuestionComment } from '../../../models';
|
|
3
|
+
import { EQuestionLike, EQuestionType, Id, IHighlight, IQuestion, IQuestionComment, IQuestionHighlights } from '../../../models';
|
|
4
4
|
import { graphqlNormalize, RestrictedData } from '../../types';
|
|
5
5
|
interface LikeData {
|
|
6
6
|
likes?: number;
|
|
@@ -9,9 +9,14 @@ interface LikeData {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const QUESTION_SBA_COMMENT_FIELDS: DocumentNode;
|
|
11
11
|
export declare const QUESTION_QA_COMMENT_FIELDS: DocumentNode;
|
|
12
|
+
export declare const QUESTION_QA_HIGHLIGHT_FIELDS: DocumentNode;
|
|
13
|
+
export declare const QUESTION_SBA_HIGHLIGHT_FIELDS: DocumentNode;
|
|
14
|
+
export declare const QUESTION_MULTIA_HIGHLIGHT_FIELDS: DocumentNode;
|
|
15
|
+
export declare const QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS: DocumentNode;
|
|
12
16
|
export declare const QUESTION_MULTIA_COMMENT_FIELDS: DocumentNode;
|
|
13
17
|
export declare const QUESTION_PRESCRIPTION_COMMENT_FIELDS: DocumentNode;
|
|
14
18
|
export declare const getLikeData: (like: EQuestionLike, item: LikeData) => LikeData;
|
|
19
|
+
export declare const getQuestionHighlightsFragment: (typeId: EQuestionType) => DocumentNode;
|
|
15
20
|
export declare const getQuestionTypeName: (typeId: EQuestionType) => string;
|
|
16
21
|
export declare const QUESTION_LIKE: DocumentNode;
|
|
17
22
|
export declare const optimisticQuestionLike: (input: IQuestionLikeVar, question: IQuestion) => IQuestionLikeData;
|
|
@@ -52,4 +57,16 @@ export interface IQuestionCommentRemoveVar {
|
|
|
52
57
|
commentId: Id;
|
|
53
58
|
}
|
|
54
59
|
export declare type IQuestionCommentRemoveData = RestrictedData<graphqlNormalize & IQuestionComment, 'questionCommentRemove'>;
|
|
60
|
+
/**
|
|
61
|
+
* addQuestionHighlight
|
|
62
|
+
*/
|
|
63
|
+
export interface IAddQuestionHighlightVar {
|
|
64
|
+
input: {
|
|
65
|
+
questionId: Id;
|
|
66
|
+
highlights: IHighlight[];
|
|
67
|
+
}[];
|
|
68
|
+
}
|
|
69
|
+
export declare type IAddQuestionHighlightData = RestrictedData<(graphqlNormalize & IQuestionHighlights)[], 'addQuestionHighlight'>;
|
|
70
|
+
export declare const ADD_QUESTION_HIGHLIGHT: DocumentNode;
|
|
71
|
+
export declare const updateQuestionHighlights: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionHighlightData>, options: ApolloUpdateOptions) => void;
|
|
55
72
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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 = exports.QUESTION_PRESCRIPTION_COMMENT_FIELDS = exports.QUESTION_MULTIA_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.getQuestionHighlightsFragment = exports.getLikeData = exports.QUESTION_PRESCRIPTION_COMMENT_FIELDS = exports.QUESTION_MULTIA_COMMENT_FIELDS = exports.QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS = exports.QUESTION_MULTIA_HIGHLIGHT_FIELDS = exports.QUESTION_SBA_HIGHLIGHT_FIELDS = exports.QUESTION_QA_HIGHLIGHT_FIELDS = exports.QUESTION_QA_COMMENT_FIELDS = exports.QUESTION_SBA_COMMENT_FIELDS = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const models_1 = require("../../../models");
|
|
6
6
|
exports.QUESTION_SBA_COMMENT_FIELDS = (0, client_1.gql) `
|
|
@@ -9,6 +9,14 @@ exports.QUESTION_SBA_COMMENT_FIELDS = (0, client_1.gql) `
|
|
|
9
9
|
likes
|
|
10
10
|
dislikes
|
|
11
11
|
isLikedByMe
|
|
12
|
+
highlights {
|
|
13
|
+
start
|
|
14
|
+
end
|
|
15
|
+
text
|
|
16
|
+
part
|
|
17
|
+
tag
|
|
18
|
+
color
|
|
19
|
+
}
|
|
12
20
|
comments {
|
|
13
21
|
id
|
|
14
22
|
createdAt
|
|
@@ -45,6 +53,14 @@ exports.QUESTION_QA_COMMENT_FIELDS = (0, client_1.gql) `
|
|
|
45
53
|
likes
|
|
46
54
|
dislikes
|
|
47
55
|
isLikedByMe
|
|
56
|
+
highlights {
|
|
57
|
+
start
|
|
58
|
+
end
|
|
59
|
+
text
|
|
60
|
+
part
|
|
61
|
+
tag
|
|
62
|
+
color
|
|
63
|
+
}
|
|
48
64
|
comments {
|
|
49
65
|
id
|
|
50
66
|
createdAt
|
|
@@ -75,12 +91,68 @@ exports.QUESTION_QA_COMMENT_FIELDS = (0, client_1.gql) `
|
|
|
75
91
|
}
|
|
76
92
|
}
|
|
77
93
|
`;
|
|
94
|
+
exports.QUESTION_QA_HIGHLIGHT_FIELDS = (0, client_1.gql) `
|
|
95
|
+
fragment QuestionQAHighlights on QuestionQA {
|
|
96
|
+
highlights {
|
|
97
|
+
start
|
|
98
|
+
end
|
|
99
|
+
text
|
|
100
|
+
part
|
|
101
|
+
tag
|
|
102
|
+
color
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
exports.QUESTION_SBA_HIGHLIGHT_FIELDS = (0, client_1.gql) `
|
|
107
|
+
fragment QuestionSBAHighlights on QuestionSBA {
|
|
108
|
+
highlights {
|
|
109
|
+
start
|
|
110
|
+
end
|
|
111
|
+
text
|
|
112
|
+
part
|
|
113
|
+
tag
|
|
114
|
+
color
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
exports.QUESTION_MULTIA_HIGHLIGHT_FIELDS = (0, client_1.gql) `
|
|
119
|
+
fragment QuestionMultiAHighlights on QuestionMultiA {
|
|
120
|
+
highlights {
|
|
121
|
+
start
|
|
122
|
+
end
|
|
123
|
+
text
|
|
124
|
+
part
|
|
125
|
+
tag
|
|
126
|
+
color
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
exports.QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS = (0, client_1.gql) `
|
|
131
|
+
fragment QuestionPrescriptionHighlights on QuestionPrescription {
|
|
132
|
+
highlights {
|
|
133
|
+
start
|
|
134
|
+
end
|
|
135
|
+
text
|
|
136
|
+
part
|
|
137
|
+
tag
|
|
138
|
+
color
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
78
142
|
exports.QUESTION_MULTIA_COMMENT_FIELDS = (0, client_1.gql) `
|
|
79
143
|
fragment QuestionMultiAComments on QuestionMultiA {
|
|
80
144
|
id
|
|
81
145
|
likes
|
|
82
146
|
dislikes
|
|
83
147
|
isLikedByMe
|
|
148
|
+
highlights {
|
|
149
|
+
start
|
|
150
|
+
end
|
|
151
|
+
text
|
|
152
|
+
part
|
|
153
|
+
tag
|
|
154
|
+
color
|
|
155
|
+
}
|
|
84
156
|
comments {
|
|
85
157
|
id
|
|
86
158
|
createdAt
|
|
@@ -117,6 +189,14 @@ exports.QUESTION_PRESCRIPTION_COMMENT_FIELDS = (0, client_1.gql) `
|
|
|
117
189
|
likes
|
|
118
190
|
dislikes
|
|
119
191
|
isLikedByMe
|
|
192
|
+
highlights {
|
|
193
|
+
start
|
|
194
|
+
end
|
|
195
|
+
text
|
|
196
|
+
part
|
|
197
|
+
tag
|
|
198
|
+
color
|
|
199
|
+
}
|
|
120
200
|
comments {
|
|
121
201
|
id
|
|
122
202
|
createdAt
|
|
@@ -172,6 +252,20 @@ const getLikeData = (like, item) => {
|
|
|
172
252
|
return { likes, dislikes, isLikedByMe: like };
|
|
173
253
|
};
|
|
174
254
|
exports.getLikeData = getLikeData;
|
|
255
|
+
const getQuestionHighlightsFragment = (typeId) => {
|
|
256
|
+
switch (typeId) {
|
|
257
|
+
case models_1.EQuestionType.QUESTION_ANSWER:
|
|
258
|
+
return exports.QUESTION_QA_HIGHLIGHT_FIELDS;
|
|
259
|
+
case models_1.EQuestionType.PRESCRIPTION_ANSWER:
|
|
260
|
+
return exports.QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS;
|
|
261
|
+
case models_1.EQuestionType.MULTIPLE_ANSWERS:
|
|
262
|
+
return exports.QUESTION_MULTIA_HIGHLIGHT_FIELDS;
|
|
263
|
+
case models_1.EQuestionType.SINGLE_BEST_ANSWER:
|
|
264
|
+
default:
|
|
265
|
+
return exports.QUESTION_SBA_HIGHLIGHT_FIELDS;
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
exports.getQuestionHighlightsFragment = getQuestionHighlightsFragment;
|
|
175
269
|
const getQuestionTypeName = (typeId) => {
|
|
176
270
|
switch (typeId) {
|
|
177
271
|
case models_1.EQuestionType.QUESTION_ANSWER:
|
|
@@ -527,3 +621,48 @@ const optimisticQuestionCommentRemove = (comments, input, parentId) => {
|
|
|
527
621
|
};
|
|
528
622
|
};
|
|
529
623
|
exports.optimisticQuestionCommentRemove = optimisticQuestionCommentRemove;
|
|
624
|
+
exports.ADD_QUESTION_HIGHLIGHT = (0, client_1.gql) `
|
|
625
|
+
mutation AddHighlight($input: [AddQuestionHighlightInput!]!) {
|
|
626
|
+
restricted {
|
|
627
|
+
addQuestionHighlight(input: $input) {
|
|
628
|
+
id
|
|
629
|
+
questionId
|
|
630
|
+
userId
|
|
631
|
+
highlights {
|
|
632
|
+
start
|
|
633
|
+
end
|
|
634
|
+
text
|
|
635
|
+
part
|
|
636
|
+
tag
|
|
637
|
+
color
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
`;
|
|
643
|
+
const updateQuestionHighlights = (typeId) => (cache, result, options) => {
|
|
644
|
+
const { addQuestionHighlight } = result?.data?.restricted ?? {};
|
|
645
|
+
const { variables } = options || {};
|
|
646
|
+
if (!variables || !addQuestionHighlight) {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
const { input } = variables;
|
|
650
|
+
try {
|
|
651
|
+
input.forEach(({ questionId }) => {
|
|
652
|
+
cache.writeFragment({
|
|
653
|
+
id: cache.identify({
|
|
654
|
+
id: questionId,
|
|
655
|
+
__typename: (0, exports.getQuestionTypeName)(typeId),
|
|
656
|
+
}),
|
|
657
|
+
data: {
|
|
658
|
+
highlights: addQuestionHighlight[0].highlights,
|
|
659
|
+
},
|
|
660
|
+
fragment: (0, exports.getQuestionHighlightsFragment)(typeId),
|
|
661
|
+
});
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
catch (error) {
|
|
665
|
+
console.error(error);
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
exports.updateQuestionHighlights = updateQuestionHighlights;
|
|
@@ -74,6 +74,14 @@ exports.MARKSHEET = (0, client_1.gql) `
|
|
|
74
74
|
question
|
|
75
75
|
totalVotes
|
|
76
76
|
typeId
|
|
77
|
+
highlights {
|
|
78
|
+
start
|
|
79
|
+
end
|
|
80
|
+
text
|
|
81
|
+
part
|
|
82
|
+
tag
|
|
83
|
+
color
|
|
84
|
+
}
|
|
77
85
|
choices {
|
|
78
86
|
id
|
|
79
87
|
explanation
|
|
@@ -135,6 +143,7 @@ exports.MARKSHEET = (0, client_1.gql) `
|
|
|
135
143
|
path
|
|
136
144
|
path512
|
|
137
145
|
path256
|
|
146
|
+
index
|
|
138
147
|
topicId
|
|
139
148
|
topic {
|
|
140
149
|
id
|
|
@@ -193,6 +202,14 @@ exports.MARKSHEET = (0, client_1.gql) `
|
|
|
193
202
|
question
|
|
194
203
|
totalVotes
|
|
195
204
|
typeId
|
|
205
|
+
highlights {
|
|
206
|
+
start
|
|
207
|
+
end
|
|
208
|
+
text
|
|
209
|
+
part
|
|
210
|
+
tag
|
|
211
|
+
color
|
|
212
|
+
}
|
|
196
213
|
choices {
|
|
197
214
|
id
|
|
198
215
|
explanation
|
|
@@ -254,6 +271,7 @@ exports.MARKSHEET = (0, client_1.gql) `
|
|
|
254
271
|
path
|
|
255
272
|
path512
|
|
256
273
|
path256
|
|
274
|
+
index
|
|
257
275
|
topicId
|
|
258
276
|
topic {
|
|
259
277
|
id
|
|
@@ -315,6 +333,14 @@ exports.MARKSHEET = (0, client_1.gql) `
|
|
|
315
333
|
question
|
|
316
334
|
totalVotes
|
|
317
335
|
typeId
|
|
336
|
+
highlights {
|
|
337
|
+
start
|
|
338
|
+
end
|
|
339
|
+
text
|
|
340
|
+
part
|
|
341
|
+
tag
|
|
342
|
+
color
|
|
343
|
+
}
|
|
318
344
|
choices {
|
|
319
345
|
id
|
|
320
346
|
explanation
|
|
@@ -376,6 +402,7 @@ exports.MARKSHEET = (0, client_1.gql) `
|
|
|
376
402
|
path
|
|
377
403
|
path512
|
|
378
404
|
path256
|
|
405
|
+
index
|
|
379
406
|
topicId
|
|
380
407
|
topic {
|
|
381
408
|
id
|
|
@@ -434,6 +461,14 @@ exports.MARKSHEET = (0, client_1.gql) `
|
|
|
434
461
|
question
|
|
435
462
|
totalVotes
|
|
436
463
|
typeId
|
|
464
|
+
highlights {
|
|
465
|
+
start
|
|
466
|
+
end
|
|
467
|
+
text
|
|
468
|
+
part
|
|
469
|
+
tag
|
|
470
|
+
color
|
|
471
|
+
}
|
|
437
472
|
choices {
|
|
438
473
|
id
|
|
439
474
|
explanation
|
|
@@ -495,6 +530,7 @@ exports.MARKSHEET = (0, client_1.gql) `
|
|
|
495
530
|
path
|
|
496
531
|
path512
|
|
497
532
|
path256
|
|
533
|
+
index
|
|
498
534
|
topicId
|
|
499
535
|
topic {
|
|
500
536
|
id
|
|
@@ -633,6 +669,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
|
|
|
633
669
|
question
|
|
634
670
|
totalVotes
|
|
635
671
|
typeId
|
|
672
|
+
highlights {
|
|
673
|
+
start
|
|
674
|
+
end
|
|
675
|
+
text
|
|
676
|
+
part
|
|
677
|
+
tag
|
|
678
|
+
color
|
|
679
|
+
}
|
|
636
680
|
choices {
|
|
637
681
|
id
|
|
638
682
|
explanation
|
|
@@ -698,6 +742,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
|
|
|
698
742
|
path
|
|
699
743
|
path512
|
|
700
744
|
path256
|
|
745
|
+
index
|
|
701
746
|
topicId
|
|
702
747
|
topic {
|
|
703
748
|
id
|
|
@@ -759,6 +804,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
|
|
|
759
804
|
question
|
|
760
805
|
totalVotes
|
|
761
806
|
typeId
|
|
807
|
+
highlights {
|
|
808
|
+
start
|
|
809
|
+
end
|
|
810
|
+
text
|
|
811
|
+
part
|
|
812
|
+
tag
|
|
813
|
+
color
|
|
814
|
+
}
|
|
762
815
|
choices {
|
|
763
816
|
id
|
|
764
817
|
explanation
|
|
@@ -820,6 +873,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
|
|
|
820
873
|
path
|
|
821
874
|
path512
|
|
822
875
|
path256
|
|
876
|
+
index
|
|
823
877
|
topicId
|
|
824
878
|
topic {
|
|
825
879
|
id
|
|
@@ -878,6 +932,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
|
|
|
878
932
|
question
|
|
879
933
|
totalVotes
|
|
880
934
|
typeId
|
|
935
|
+
highlights {
|
|
936
|
+
start
|
|
937
|
+
end
|
|
938
|
+
text
|
|
939
|
+
part
|
|
940
|
+
tag
|
|
941
|
+
color
|
|
942
|
+
}
|
|
881
943
|
choices {
|
|
882
944
|
id
|
|
883
945
|
explanation
|
|
@@ -939,6 +1001,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
|
|
|
939
1001
|
path
|
|
940
1002
|
path512
|
|
941
1003
|
path256
|
|
1004
|
+
index
|
|
942
1005
|
topicId
|
|
943
1006
|
topic {
|
|
944
1007
|
id
|
|
@@ -1000,6 +1063,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
|
|
|
1000
1063
|
question
|
|
1001
1064
|
totalVotes
|
|
1002
1065
|
typeId
|
|
1066
|
+
highlights {
|
|
1067
|
+
start
|
|
1068
|
+
end
|
|
1069
|
+
text
|
|
1070
|
+
part
|
|
1071
|
+
tag
|
|
1072
|
+
color
|
|
1073
|
+
}
|
|
1003
1074
|
choices {
|
|
1004
1075
|
id
|
|
1005
1076
|
explanation
|
|
@@ -1061,6 +1132,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
|
|
|
1061
1132
|
path
|
|
1062
1133
|
path512
|
|
1063
1134
|
path256
|
|
1135
|
+
index
|
|
1064
1136
|
topicId
|
|
1065
1137
|
topic {
|
|
1066
1138
|
id
|
|
@@ -1119,6 +1191,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
|
|
|
1119
1191
|
question
|
|
1120
1192
|
totalVotes
|
|
1121
1193
|
typeId
|
|
1194
|
+
highlights {
|
|
1195
|
+
start
|
|
1196
|
+
end
|
|
1197
|
+
text
|
|
1198
|
+
part
|
|
1199
|
+
tag
|
|
1200
|
+
color
|
|
1201
|
+
}
|
|
1122
1202
|
choices {
|
|
1123
1203
|
id
|
|
1124
1204
|
explanation
|
|
@@ -1180,6 +1260,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
|
|
|
1180
1260
|
path
|
|
1181
1261
|
path512
|
|
1182
1262
|
path256
|
|
1263
|
+
index
|
|
1183
1264
|
topicId
|
|
1184
1265
|
topic {
|
|
1185
1266
|
id
|
|
@@ -1326,6 +1407,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
|
|
|
1326
1407
|
question
|
|
1327
1408
|
totalVotes
|
|
1328
1409
|
typeId
|
|
1410
|
+
highlights {
|
|
1411
|
+
start
|
|
1412
|
+
end
|
|
1413
|
+
text
|
|
1414
|
+
part
|
|
1415
|
+
tag
|
|
1416
|
+
color
|
|
1417
|
+
}
|
|
1329
1418
|
choices {
|
|
1330
1419
|
id
|
|
1331
1420
|
explanation
|
|
@@ -1387,6 +1476,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
|
|
|
1387
1476
|
path
|
|
1388
1477
|
path512
|
|
1389
1478
|
path256
|
|
1479
|
+
index
|
|
1390
1480
|
topicId
|
|
1391
1481
|
topic {
|
|
1392
1482
|
id
|
|
@@ -1445,6 +1535,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
|
|
|
1445
1535
|
question
|
|
1446
1536
|
totalVotes
|
|
1447
1537
|
typeId
|
|
1538
|
+
highlights {
|
|
1539
|
+
start
|
|
1540
|
+
end
|
|
1541
|
+
text
|
|
1542
|
+
part
|
|
1543
|
+
tag
|
|
1544
|
+
color
|
|
1545
|
+
}
|
|
1448
1546
|
choices {
|
|
1449
1547
|
id
|
|
1450
1548
|
explanation
|
|
@@ -1506,6 +1604,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
|
|
|
1506
1604
|
path
|
|
1507
1605
|
path512
|
|
1508
1606
|
path256
|
|
1607
|
+
index
|
|
1509
1608
|
topicId
|
|
1510
1609
|
topic {
|
|
1511
1610
|
id
|
|
@@ -1567,6 +1666,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
|
|
|
1567
1666
|
question
|
|
1568
1667
|
totalVotes
|
|
1569
1668
|
typeId
|
|
1669
|
+
highlights {
|
|
1670
|
+
start
|
|
1671
|
+
end
|
|
1672
|
+
text
|
|
1673
|
+
part
|
|
1674
|
+
tag
|
|
1675
|
+
color
|
|
1676
|
+
}
|
|
1570
1677
|
choices {
|
|
1571
1678
|
id
|
|
1572
1679
|
explanation
|
|
@@ -1628,6 +1735,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
|
|
|
1628
1735
|
path
|
|
1629
1736
|
path512
|
|
1630
1737
|
path256
|
|
1738
|
+
index
|
|
1631
1739
|
topicId
|
|
1632
1740
|
topic {
|
|
1633
1741
|
id
|
|
@@ -1686,6 +1794,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
|
|
|
1686
1794
|
question
|
|
1687
1795
|
totalVotes
|
|
1688
1796
|
typeId
|
|
1797
|
+
highlights {
|
|
1798
|
+
start
|
|
1799
|
+
end
|
|
1800
|
+
text
|
|
1801
|
+
part
|
|
1802
|
+
tag
|
|
1803
|
+
color
|
|
1804
|
+
}
|
|
1689
1805
|
choices {
|
|
1690
1806
|
id
|
|
1691
1807
|
explanation
|
|
@@ -1747,6 +1863,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
|
|
|
1747
1863
|
path
|
|
1748
1864
|
path512
|
|
1749
1865
|
path256
|
|
1866
|
+
index
|
|
1750
1867
|
topicId
|
|
1751
1868
|
topic {
|
|
1752
1869
|
id
|
|
@@ -78,6 +78,7 @@ exports.QUESTION = (0, client_1.gql) `
|
|
|
78
78
|
path
|
|
79
79
|
path512
|
|
80
80
|
path256
|
|
81
|
+
index
|
|
81
82
|
topicId
|
|
82
83
|
topic {
|
|
83
84
|
id
|
|
@@ -197,6 +198,7 @@ exports.QUESTION = (0, client_1.gql) `
|
|
|
197
198
|
path
|
|
198
199
|
path512
|
|
199
200
|
path256
|
|
201
|
+
index
|
|
200
202
|
topicId
|
|
201
203
|
topic {
|
|
202
204
|
id
|
|
@@ -319,6 +321,7 @@ exports.QUESTION = (0, client_1.gql) `
|
|
|
319
321
|
path
|
|
320
322
|
path512
|
|
321
323
|
path256
|
|
324
|
+
index
|
|
322
325
|
topicId
|
|
323
326
|
topic {
|
|
324
327
|
id
|
|
@@ -438,6 +441,7 @@ exports.QUESTION = (0, client_1.gql) `
|
|
|
438
441
|
path
|
|
439
442
|
path512
|
|
440
443
|
path256
|
|
444
|
+
index
|
|
441
445
|
topicId
|
|
442
446
|
topic {
|
|
443
447
|
id
|
|
@@ -59,6 +59,7 @@ exports.SAMPLE_MARKSHEET = (0, client_1.gql) `
|
|
|
59
59
|
path
|
|
60
60
|
path512
|
|
61
61
|
path256
|
|
62
|
+
index
|
|
62
63
|
topicId
|
|
63
64
|
topic {
|
|
64
65
|
id
|
|
@@ -122,6 +123,7 @@ exports.SAMPLE_TODO = (0, client_1.gql) `
|
|
|
122
123
|
path
|
|
123
124
|
path512
|
|
124
125
|
path256
|
|
126
|
+
index
|
|
125
127
|
topicId
|
|
126
128
|
topic {
|
|
127
129
|
id
|
package/resolvers/query/video.js
CHANGED
package/utils/lightgallery.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lightgalleryOsceResolve = void 0;
|
|
4
|
-
const lightgalleryRegex = /\[(
|
|
4
|
+
const lightgalleryRegex = /\[lightgallery([0-9]{0,})\]/;
|
|
5
5
|
function isOsceMarksheet(data) {
|
|
6
6
|
return 'osceStationId' in data;
|
|
7
7
|
}
|
|
@@ -55,7 +55,7 @@ const lightgalleryMutation = async (text, pictures, cache) => {
|
|
|
55
55
|
if (pictures.length === 0) {
|
|
56
56
|
return text;
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const picturesMdMap = {};
|
|
59
59
|
for (const picture of pictures) {
|
|
60
60
|
const pic = picture.path;
|
|
61
61
|
const uri = `https://app.quesmed.com/${pic}`;
|
|
@@ -74,19 +74,32 @@ const lightgalleryMutation = async (text, pictures, cache) => {
|
|
|
74
74
|
console.error(e);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
let mdPic = ``;
|
|
77
78
|
if (picture.caption?.length > 0) {
|
|
78
|
-
|
|
79
|
+
mdPic = ``;
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
+
if (!picturesMdMap[picture.index]) {
|
|
82
|
+
picturesMdMap[picture.index] = [];
|
|
83
|
+
}
|
|
84
|
+
picturesMdMap[picture.index].push(mdPic);
|
|
81
85
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
const matches = text.matchAll(lightgalleryRegex);
|
|
87
|
+
let matchExists = false;
|
|
88
|
+
for (const match of matches) {
|
|
89
|
+
const index = parseInt(match[1]);
|
|
90
|
+
if (index === 0) {
|
|
91
|
+
matchExists = true;
|
|
92
|
+
}
|
|
93
|
+
if (!picturesMdMap[index]) {
|
|
94
|
+
// TODO: report to sentry or err that lightgallery pictures are missing
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const mdPics = picturesMdMap[index].join(' ');
|
|
98
|
+
const lightgalleryTagToReplace = `[lightgallery${index > 0 ? index : ''}]`;
|
|
99
|
+
text = text.replace(lightgalleryTagToReplace, mdPics);
|
|
88
100
|
}
|
|
89
|
-
|
|
90
|
-
return text + '\n\n' +
|
|
101
|
+
if (!matchExists) {
|
|
102
|
+
return text + '\n\n' + picturesMdMap[0].join(' ') + '\n';
|
|
91
103
|
}
|
|
104
|
+
return text;
|
|
92
105
|
};
|