@quesmed/types 2.6.68 → 2.6.70
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/dist/cjs/resolvers/mutation/restricted/chapter.d.ts +1 -1
- package/dist/cjs/resolvers/mutation/restricted/chapter.js +11 -2
- package/dist/cjs/resolvers/mutation/restricted/questionDiscussion.js +2 -2
- package/dist/cjs/resolvers/mutation/restricted/video.d.ts +2 -2
- package/dist/cjs/resolvers/mutation/restricted/video.js +31 -1
- package/dist/mjs/resolvers/mutation/restricted/chapter.d.ts +1 -1
- package/dist/mjs/resolvers/mutation/restricted/chapter.js +11 -2
- package/dist/mjs/resolvers/mutation/restricted/questionDiscussion.js +2 -2
- package/dist/mjs/resolvers/mutation/restricted/video.d.ts +2 -2
- package/dist/mjs/resolvers/mutation/restricted/video.js +31 -1
- package/package.json +1 -1
|
@@ -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
|
},
|
|
@@ -400,10 +400,10 @@ const updateQuestionLearningPoint = (typeId) => (cache, result, options) => {
|
|
|
400
400
|
return;
|
|
401
401
|
}
|
|
402
402
|
try {
|
|
403
|
-
for (const {
|
|
403
|
+
for (const { questionId, userPoint } of addQuestionLearningPoint) {
|
|
404
404
|
cache.writeFragment({
|
|
405
405
|
id: cache.identify({
|
|
406
|
-
id,
|
|
406
|
+
id: questionId,
|
|
407
407
|
__typename: (0, exports.getQuestionTypeName)(typeId),
|
|
408
408
|
}),
|
|
409
409
|
data: {
|
|
@@ -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;
|
|
@@ -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
|
}[];
|
|
@@ -4,9 +4,17 @@ import { CHAPTER_WITH_HIGHLIGHT_FIELDS, HIGHLIGHT_FIELDS, UPSERT_CHAPTER_NOTE_FR
|
|
|
4
4
|
* upsertChapterNote
|
|
5
5
|
*/
|
|
6
6
|
export const UPSERT_CHAPTER_NOTE = gql `
|
|
7
|
-
mutation UpsertChapterNote(
|
|
7
|
+
mutation UpsertChapterNote(
|
|
8
|
+
$chapterId: Int!
|
|
9
|
+
$note: String!
|
|
10
|
+
$marksheetId: Int
|
|
11
|
+
) {
|
|
8
12
|
restricted {
|
|
9
|
-
upsertChapterNote(
|
|
13
|
+
upsertChapterNote(
|
|
14
|
+
chapterId: $chapterId
|
|
15
|
+
note: $note
|
|
16
|
+
marksheetId: $marksheetId
|
|
17
|
+
) {
|
|
10
18
|
id
|
|
11
19
|
chapterId
|
|
12
20
|
userId
|
|
@@ -107,6 +115,7 @@ export const getChapterHighlightOptimisticResponse = (userId, highlights, chapte
|
|
|
107
115
|
tag: '',
|
|
108
116
|
color: '',
|
|
109
117
|
...highlight,
|
|
118
|
+
part: highlight.part || '',
|
|
110
119
|
})),
|
|
111
120
|
__typename: 'ChapterHighlight',
|
|
112
121
|
},
|
|
@@ -388,10 +388,10 @@ export const updateQuestionLearningPoint = (typeId) => (cache, result, options)
|
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
390
|
try {
|
|
391
|
-
for (const {
|
|
391
|
+
for (const { questionId, userPoint } of addQuestionLearningPoint) {
|
|
392
392
|
cache.writeFragment({
|
|
393
393
|
id: cache.identify({
|
|
394
|
-
id,
|
|
394
|
+
id: questionId,
|
|
395
395
|
__typename: getQuestionTypeName(typeId),
|
|
396
396
|
}),
|
|
397
397
|
data: {
|
|
@@ -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;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { VIDEO_USER_VIEWED_FRAGMENT } from '../../fragments';
|
|
3
|
+
import { OSCE_STATS, } from '../../query/restricted/osce';
|
|
3
4
|
export const VIDEO_WATCHED = gql `
|
|
4
5
|
mutation VideoWatched($id: Int!) {
|
|
5
6
|
restricted {
|
|
@@ -11,7 +12,7 @@ export const VIDEO_WATCHED = gql `
|
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
`;
|
|
14
|
-
export const updateCacheOnVideoWatched = (cache, result) => {
|
|
15
|
+
export const updateCacheOnVideoWatched = (entitlementId) => (cache, result) => {
|
|
15
16
|
const { videoWatched } = result?.data?.restricted || {};
|
|
16
17
|
if (!videoWatched) {
|
|
17
18
|
return;
|
|
@@ -24,4 +25,33 @@ export const updateCacheOnVideoWatched = (cache, result) => {
|
|
|
24
25
|
},
|
|
25
26
|
fragment: VIDEO_USER_VIEWED_FRAGMENT,
|
|
26
27
|
});
|
|
28
|
+
if (entitlementId) {
|
|
29
|
+
const prevOsceStats = cache?.readQuery({
|
|
30
|
+
query: OSCE_STATS,
|
|
31
|
+
variables: { solo: true },
|
|
32
|
+
});
|
|
33
|
+
if (prevOsceStats) {
|
|
34
|
+
const { completed, types } = prevOsceStats.restricted.osceStats;
|
|
35
|
+
cache.writeQuery({
|
|
36
|
+
query: OSCE_STATS,
|
|
37
|
+
data: {
|
|
38
|
+
...prevOsceStats,
|
|
39
|
+
restricted: {
|
|
40
|
+
...prevOsceStats.restricted,
|
|
41
|
+
osceStats: {
|
|
42
|
+
...prevOsceStats.restricted.osceStats,
|
|
43
|
+
completed: Number(completed) + 1,
|
|
44
|
+
types: types?.map(({ id, completed, ...rest }) => ({
|
|
45
|
+
id,
|
|
46
|
+
completed: Number(id) === Number(entitlementId)
|
|
47
|
+
? Number(completed) + 1
|
|
48
|
+
: completed,
|
|
49
|
+
...rest,
|
|
50
|
+
})),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
27
57
|
};
|