@quesmed/types-rn 2.6.67 → 2.6.69
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/Question.d.ts +3 -1
- package/models/User.d.ts +12 -0
- package/models/User.js +6 -1
- package/package.json +1 -1
- package/resolvers/fragments/question.d.ts +1 -0
- package/resolvers/fragments/question.js +9 -1
- package/resolvers/mutation/restricted/chapter.d.ts +1 -1
- package/resolvers/mutation/restricted/chapter.js +11 -2
- package/resolvers/mutation/restricted/questionDiscussion.d.ts +14 -1
- package/resolvers/mutation/restricted/questionDiscussion.js +41 -1
- package/resolvers/mutation/restricted/video.d.ts +2 -2
- package/resolvers/mutation/restricted/video.js +31 -1
package/models/Question.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { IPresentation } from './Presentation';
|
|
|
7
7
|
import { ITopic } from './Topic';
|
|
8
8
|
import { Id } from './Type';
|
|
9
9
|
import { IUkmlaTopic } from './UkmlaTopic';
|
|
10
|
-
import { IUser } from './User';
|
|
10
|
+
import { EUserLearningPoint, IUser } from './User';
|
|
11
11
|
export declare enum EPsaSectionType {
|
|
12
12
|
PRESCRIBING = 1,
|
|
13
13
|
PRESCRIPTION_REVIEW = 2,
|
|
@@ -77,6 +77,7 @@ export interface IQuestion {
|
|
|
77
77
|
presentation?: IPresentation[];
|
|
78
78
|
question: string;
|
|
79
79
|
explanation?: string;
|
|
80
|
+
learningPoint?: string;
|
|
80
81
|
answer: IQuestionAnswer;
|
|
81
82
|
totalVotes: number;
|
|
82
83
|
choices: IQuestionChoice[];
|
|
@@ -87,6 +88,7 @@ export interface IQuestion {
|
|
|
87
88
|
difficulty: EDifficultyType;
|
|
88
89
|
elo: number;
|
|
89
90
|
psaSectionId: EPsaSectionType;
|
|
91
|
+
userPoint?: EUserLearningPoint | null;
|
|
90
92
|
likes?: number;
|
|
91
93
|
dislikes?: number;
|
|
92
94
|
isLikedByMe?: EQuestionLike;
|
package/models/User.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ export declare enum EUserLearningStatus {
|
|
|
34
34
|
REVISING = 3,
|
|
35
35
|
URGENT = 4
|
|
36
36
|
}
|
|
37
|
+
export declare enum EUserLearningPoint {
|
|
38
|
+
NOT_RELEVANT = 0,
|
|
39
|
+
RELEVANT = 1
|
|
40
|
+
}
|
|
37
41
|
export declare const classYearGroup: {
|
|
38
42
|
[key: string]: EClassYearGroup;
|
|
39
43
|
};
|
|
@@ -248,3 +252,11 @@ export interface IUserStats {
|
|
|
248
252
|
median: number;
|
|
249
253
|
series: [x: number, y: number][];
|
|
250
254
|
}
|
|
255
|
+
export interface IQuestionLearningPoint {
|
|
256
|
+
id: Id;
|
|
257
|
+
createdAt: number | Date;
|
|
258
|
+
updatedAt: number | Date;
|
|
259
|
+
userId: Id;
|
|
260
|
+
questionId: Id;
|
|
261
|
+
userPoint: EUserLearningPoint | null;
|
|
262
|
+
}
|
package/models/User.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.currentClassGroup = exports.currentClassYear = exports.EPracticeIntensity = exports.classYearGroup = exports.EUserLearningStatus = exports.EClassYearGroup = exports.dateProductMapping = exports.subscriptionDates = exports.classYears = exports.IAccessLevel = void 0;
|
|
3
|
+
exports.currentClassGroup = exports.currentClassYear = exports.EPracticeIntensity = exports.classYearGroup = exports.EUserLearningPoint = exports.EUserLearningStatus = exports.EClassYearGroup = exports.dateProductMapping = exports.subscriptionDates = exports.classYears = exports.IAccessLevel = void 0;
|
|
4
4
|
const luxon_1 = require("luxon");
|
|
5
5
|
const Product_1 = require("./Product");
|
|
6
6
|
var IAccessLevel;
|
|
@@ -68,6 +68,11 @@ var EUserLearningStatus;
|
|
|
68
68
|
EUserLearningStatus[EUserLearningStatus["REVISING"] = 3] = "REVISING";
|
|
69
69
|
EUserLearningStatus[EUserLearningStatus["URGENT"] = 4] = "URGENT";
|
|
70
70
|
})(EUserLearningStatus = exports.EUserLearningStatus || (exports.EUserLearningStatus = {}));
|
|
71
|
+
var EUserLearningPoint;
|
|
72
|
+
(function (EUserLearningPoint) {
|
|
73
|
+
EUserLearningPoint[EUserLearningPoint["NOT_RELEVANT"] = 0] = "NOT_RELEVANT";
|
|
74
|
+
EUserLearningPoint[EUserLearningPoint["RELEVANT"] = 1] = "RELEVANT";
|
|
75
|
+
})(EUserLearningPoint = exports.EUserLearningPoint || (exports.EUserLearningPoint = {}));
|
|
71
76
|
exports.classYearGroup = {
|
|
72
77
|
'Year 1': EClassYearGroup.PRECLINICAL,
|
|
73
78
|
'Year 2': EClassYearGroup.PRECLINICAL,
|
package/package.json
CHANGED
|
@@ -3,3 +3,4 @@ export declare const QUESTION_CATEGORY_FIELDS: import("@apollo/client").Document
|
|
|
3
3
|
export declare const QUESTION_FIELDS: import("@apollo/client").DocumentNode;
|
|
4
4
|
export declare const QUESTION_WITH_HIGHLIGHT_FIELDS: import("@apollo/client").DocumentNode;
|
|
5
5
|
export declare const QUESTION_WITH_COMMENT_FIELDS: import("@apollo/client").DocumentNode;
|
|
6
|
+
export declare const QUESTION_WITH_LEARNING_FIELDS: import("@apollo/client").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QUESTION_WITH_COMMENT_FIELDS = exports.QUESTION_WITH_HIGHLIGHT_FIELDS = exports.QUESTION_FIELDS = exports.QUESTION_CATEGORY_FIELDS = exports.QUESTION_COMMENT_FIELDS = void 0;
|
|
3
|
+
exports.QUESTION_WITH_LEARNING_FIELDS = exports.QUESTION_WITH_COMMENT_FIELDS = exports.QUESTION_WITH_HIGHLIGHT_FIELDS = exports.QUESTION_FIELDS = exports.QUESTION_CATEGORY_FIELDS = exports.QUESTION_COMMENT_FIELDS = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const concept_1 = require("./concept");
|
|
6
6
|
const highlight_1 = require("./highlight");
|
|
@@ -110,7 +110,9 @@ exports.QUESTION_FIELDS = (0, client_1.gql) `
|
|
|
110
110
|
difficulty
|
|
111
111
|
dislikes
|
|
112
112
|
explanation
|
|
113
|
+
learningPoint
|
|
113
114
|
isLikedByMe
|
|
115
|
+
userPoint
|
|
114
116
|
likes
|
|
115
117
|
question
|
|
116
118
|
totalVotes
|
|
@@ -170,3 +172,9 @@ exports.QUESTION_WITH_COMMENT_FIELDS = (0, client_1.gql) `
|
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
`;
|
|
175
|
+
// used in cache updator
|
|
176
|
+
exports.QUESTION_WITH_LEARNING_FIELDS = (0, client_1.gql) `
|
|
177
|
+
fragment QuestionWithLearningFields on Question {
|
|
178
|
+
userPoint
|
|
179
|
+
}
|
|
180
|
+
`;
|
|
@@ -39,11 +39,11 @@ export declare const getChapterHighlightOptimisticResponse: (userId: number, hig
|
|
|
39
39
|
updatedAt: number;
|
|
40
40
|
deletedAt: number;
|
|
41
41
|
highlights: {
|
|
42
|
+
part: string;
|
|
42
43
|
start: number;
|
|
43
44
|
end: number;
|
|
44
45
|
text: string;
|
|
45
46
|
color: string;
|
|
46
|
-
part?: string | undefined;
|
|
47
47
|
tag: string;
|
|
48
48
|
__typename: string;
|
|
49
49
|
}[];
|
|
@@ -7,9 +7,17 @@ const fragments_1 = require("../../fragments");
|
|
|
7
7
|
* upsertChapterNote
|
|
8
8
|
*/
|
|
9
9
|
exports.UPSERT_CHAPTER_NOTE = (0, client_1.gql) `
|
|
10
|
-
mutation UpsertChapterNote(
|
|
10
|
+
mutation UpsertChapterNote(
|
|
11
|
+
$chapterId: Int!
|
|
12
|
+
$note: String!
|
|
13
|
+
$marksheetId: Int
|
|
14
|
+
) {
|
|
11
15
|
restricted {
|
|
12
|
-
upsertChapterNote(
|
|
16
|
+
upsertChapterNote(
|
|
17
|
+
chapterId: $chapterId
|
|
18
|
+
note: $note
|
|
19
|
+
marksheetId: $marksheetId
|
|
20
|
+
) {
|
|
13
21
|
id
|
|
14
22
|
chapterId
|
|
15
23
|
userId
|
|
@@ -113,6 +121,7 @@ const getChapterHighlightOptimisticResponse = (userId, highlights, chapterId) =>
|
|
|
113
121
|
tag: '',
|
|
114
122
|
color: '',
|
|
115
123
|
...highlight,
|
|
124
|
+
part: highlight.part || '',
|
|
116
125
|
})),
|
|
117
126
|
__typename: 'ChapterHighlight',
|
|
118
127
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
2
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
|
|
3
|
-
import { EQuestionLike, EQuestionType, IAccessLevel, IHighlightNode, IQuestion, IQuestionComment, IQuestionHighlight, Id } from '../../../models';
|
|
3
|
+
import { EQuestionLike, EQuestionType, EUserLearningPoint, IAccessLevel, IHighlightNode, IQuestion, IQuestionComment, IQuestionHighlight, IQuestionLearningPoint, Id } from '../../../models';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
5
|
interface LikeData {
|
|
6
6
|
likes?: number;
|
|
@@ -62,6 +62,19 @@ export interface IAddQuestionHighlightVar {
|
|
|
62
62
|
export type IAddQuestionHighlightData = RestrictedData<(graphqlNormalize & IQuestionHighlight)[], 'addQuestionHighlight'>;
|
|
63
63
|
export declare const ADD_QUESTION_HIGHLIGHT: import("@apollo/client").DocumentNode;
|
|
64
64
|
export declare const updateQuestionHighlights: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionHighlightData>, options: ApolloUpdateOptions<IAddQuestionHighlightVar>) => void;
|
|
65
|
+
/**
|
|
66
|
+
* addQuestionLearningPoint
|
|
67
|
+
*/
|
|
68
|
+
export interface IAddQuestionLearningPointVar {
|
|
69
|
+
marksheetId?: number;
|
|
70
|
+
input: {
|
|
71
|
+
questionId: Id;
|
|
72
|
+
userPoint: EUserLearningPoint;
|
|
73
|
+
}[];
|
|
74
|
+
}
|
|
75
|
+
export type IAddQuestionLearningPointData = RestrictedData<(graphqlNormalize & IQuestionLearningPoint)[], 'addQuestionLearningPoint'>;
|
|
76
|
+
export declare const ADD_QUESTION_LEARNING_POINT: import("@apollo/client").DocumentNode;
|
|
77
|
+
export declare const updateQuestionLearningPoint: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionLearningPointData>, options: ApolloUpdateOptions<IAddQuestionLearningPointVar>) => void;
|
|
65
78
|
export declare const getQuestionHighlightOptimisticResponse: (userId: number, highlights: IHighlightNode[], questionId: number) => {
|
|
66
79
|
restricted: {
|
|
67
80
|
addQuestionHighlight: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getQuestionHighlightOptimisticResponse = 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;
|
|
3
|
+
exports.getQuestionHighlightOptimisticResponse = exports.updateQuestionLearningPoint = exports.ADD_QUESTION_LEARNING_POINT = 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");
|
|
@@ -378,6 +378,46 @@ const updateQuestionHighlights = (typeId) => (cache, result, options) => {
|
|
|
378
378
|
}
|
|
379
379
|
};
|
|
380
380
|
exports.updateQuestionHighlights = updateQuestionHighlights;
|
|
381
|
+
exports.ADD_QUESTION_LEARNING_POINT = (0, client_1.gql) `
|
|
382
|
+
mutation AddQuestionLearningPoint(
|
|
383
|
+
$input: [AddQuestionLearningPointInput!]!
|
|
384
|
+
$marksheetId: Int
|
|
385
|
+
) {
|
|
386
|
+
restricted {
|
|
387
|
+
addQuestionLearningPoint(input: $input, marksheetId: $marksheetId) {
|
|
388
|
+
id
|
|
389
|
+
questionId
|
|
390
|
+
userId
|
|
391
|
+
userPoint
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
`;
|
|
396
|
+
const updateQuestionLearningPoint = (typeId) => (cache, result, options) => {
|
|
397
|
+
const { addQuestionLearningPoint } = result?.data?.restricted ?? {};
|
|
398
|
+
const { variables } = options || {};
|
|
399
|
+
if (!variables || !addQuestionLearningPoint) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
try {
|
|
403
|
+
for (const { id, userPoint } of addQuestionLearningPoint) {
|
|
404
|
+
cache.writeFragment({
|
|
405
|
+
id: cache.identify({
|
|
406
|
+
id,
|
|
407
|
+
__typename: (0, exports.getQuestionTypeName)(typeId),
|
|
408
|
+
}),
|
|
409
|
+
data: {
|
|
410
|
+
userPoint,
|
|
411
|
+
},
|
|
412
|
+
fragment: fragments_1.QUESTION_WITH_LEARNING_FIELDS,
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
catch (error) {
|
|
417
|
+
console.error(error);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
exports.updateQuestionLearningPoint = updateQuestionLearningPoint;
|
|
381
421
|
const getQuestionHighlightOptimisticResponse = (userId, highlights, questionId) => {
|
|
382
422
|
const date = new Date().getTime();
|
|
383
423
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { IVideo, Id } from '../../../models';
|
|
2
|
+
import { EEntitlementType, IVideo, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
5
|
export declare const VIDEO_WATCHED: import("@apollo/client").DocumentNode;
|
|
@@ -7,4 +7,4 @@ export interface IVideoWatchedVar {
|
|
|
7
7
|
id: Id;
|
|
8
8
|
}
|
|
9
9
|
export type IVideoWatchedData = RestrictedData<graphqlNormalize & IVideo, 'videoWatched'>;
|
|
10
|
-
export declare const updateCacheOnVideoWatched: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IVideoWatchedData>) => void;
|
|
10
|
+
export declare const updateCacheOnVideoWatched: (entitlementId?: EEntitlementType | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IVideoWatchedData>) => void;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateCacheOnVideoWatched = exports.VIDEO_WATCHED = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const fragments_1 = require("../../fragments");
|
|
6
|
+
const osce_1 = require("../../query/restricted/osce");
|
|
6
7
|
exports.VIDEO_WATCHED = (0, client_1.gql) `
|
|
7
8
|
mutation VideoWatched($id: Int!) {
|
|
8
9
|
restricted {
|
|
@@ -14,7 +15,7 @@ exports.VIDEO_WATCHED = (0, client_1.gql) `
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
`;
|
|
17
|
-
const updateCacheOnVideoWatched = (cache, result) => {
|
|
18
|
+
const updateCacheOnVideoWatched = (entitlementId) => (cache, result) => {
|
|
18
19
|
const { videoWatched } = result?.data?.restricted || {};
|
|
19
20
|
if (!videoWatched) {
|
|
20
21
|
return;
|
|
@@ -27,5 +28,34 @@ const updateCacheOnVideoWatched = (cache, result) => {
|
|
|
27
28
|
},
|
|
28
29
|
fragment: fragments_1.VIDEO_USER_VIEWED_FRAGMENT,
|
|
29
30
|
});
|
|
31
|
+
if (entitlementId) {
|
|
32
|
+
const prevOsceStats = cache?.readQuery({
|
|
33
|
+
query: osce_1.OSCE_STATS,
|
|
34
|
+
variables: { solo: true },
|
|
35
|
+
});
|
|
36
|
+
if (prevOsceStats) {
|
|
37
|
+
const { completed, types } = prevOsceStats.restricted.osceStats;
|
|
38
|
+
cache.writeQuery({
|
|
39
|
+
query: osce_1.OSCE_STATS,
|
|
40
|
+
data: {
|
|
41
|
+
...prevOsceStats,
|
|
42
|
+
restricted: {
|
|
43
|
+
...prevOsceStats.restricted,
|
|
44
|
+
osceStats: {
|
|
45
|
+
...prevOsceStats.restricted.osceStats,
|
|
46
|
+
completed: Number(completed) + 1,
|
|
47
|
+
types: types?.map(({ id, completed, ...rest }) => ({
|
|
48
|
+
id,
|
|
49
|
+
completed: Number(id) === Number(entitlementId)
|
|
50
|
+
? Number(completed) + 1
|
|
51
|
+
: completed,
|
|
52
|
+
...rest,
|
|
53
|
+
})),
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
30
60
|
};
|
|
31
61
|
exports.updateCacheOnVideoWatched = updateCacheOnVideoWatched;
|