@quesmed/types 2.6.55 → 2.6.57
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/models/Chapter.d.ts +3 -1
- package/dist/cjs/models/Highlight.d.ts +29 -0
- package/dist/cjs/models/Highlight.js +2 -0
- package/dist/cjs/models/Note.d.ts +18 -0
- package/dist/cjs/models/Note.js +2 -0
- package/dist/cjs/models/OsceStation.d.ts +2 -0
- package/dist/cjs/models/Question.d.ts +2 -20
- package/dist/cjs/models/User.d.ts +1 -12
- package/dist/cjs/models/index.d.ts +2 -0
- package/dist/cjs/models/index.js +2 -0
- package/dist/cjs/resolvers/fragments/chapter.d.ts +1 -0
- package/dist/cjs/resolvers/fragments/chapter.js +20 -1
- package/dist/cjs/resolvers/fragments/highlight.d.ts +1 -0
- package/dist/cjs/resolvers/fragments/highlight.js +14 -0
- package/dist/cjs/resolvers/fragments/index.d.ts +1 -0
- package/dist/cjs/resolvers/fragments/index.js +1 -0
- package/dist/cjs/resolvers/fragments/osce.d.ts +1 -0
- package/dist/cjs/resolvers/fragments/osce.js +13 -1
- package/dist/cjs/resolvers/fragments/question.js +3 -6
- package/dist/cjs/resolvers/mutation/restricted/chapter.d.ts +18 -2
- package/dist/cjs/resolvers/mutation/restricted/chapter.js +47 -1
- package/dist/cjs/resolvers/mutation/restricted/osce.d.ts +25 -1
- package/dist/cjs/resolvers/mutation/restricted/osce.js +67 -20
- package/dist/cjs/resolvers/mutation/restricted/questionDiscussion.d.ts +3 -3
- package/dist/cjs/resolvers/mutation/restricted/questionDiscussion.js +3 -7
- package/dist/mjs/models/Chapter.d.ts +3 -1
- package/dist/mjs/models/Highlight.d.ts +29 -0
- package/dist/mjs/models/Highlight.js +1 -0
- package/dist/mjs/models/Note.d.ts +18 -0
- package/dist/mjs/models/Note.js +1 -0
- package/dist/mjs/models/OsceStation.d.ts +2 -0
- package/dist/mjs/models/Question.d.ts +2 -20
- package/dist/mjs/models/User.d.ts +1 -12
- package/dist/mjs/models/index.d.ts +2 -0
- package/dist/mjs/models/index.js +2 -0
- package/dist/mjs/resolvers/fragments/chapter.d.ts +1 -0
- package/dist/mjs/resolvers/fragments/chapter.js +19 -0
- package/dist/mjs/resolvers/fragments/highlight.d.ts +1 -0
- package/dist/mjs/resolvers/fragments/highlight.js +11 -0
- package/dist/mjs/resolvers/fragments/index.d.ts +1 -0
- package/dist/mjs/resolvers/fragments/index.js +1 -0
- package/dist/mjs/resolvers/fragments/osce.d.ts +1 -0
- package/dist/mjs/resolvers/fragments/osce.js +12 -0
- package/dist/mjs/resolvers/fragments/question.js +3 -6
- package/dist/mjs/resolvers/mutation/restricted/chapter.d.ts +18 -2
- package/dist/mjs/resolvers/mutation/restricted/chapter.js +46 -1
- package/dist/mjs/resolvers/mutation/restricted/osce.d.ts +25 -1
- package/dist/mjs/resolvers/mutation/restricted/osce.js +47 -2
- package/dist/mjs/resolvers/mutation/restricted/questionDiscussion.d.ts +3 -3
- package/dist/mjs/resolvers/mutation/restricted/questionDiscussion.js +4 -8
- package/package.json +1 -1
|
@@ -336,7 +336,8 @@ const optimisticQuestionCommentRemove = (comments, input, parentId) => {
|
|
|
336
336
|
};
|
|
337
337
|
exports.optimisticQuestionCommentRemove = optimisticQuestionCommentRemove;
|
|
338
338
|
exports.ADD_QUESTION_HIGHLIGHT = (0, client_1.gql) `
|
|
339
|
-
|
|
339
|
+
${fragments_1.HIGHLIGHT_FIELDS}
|
|
340
|
+
mutation AddQuestionHighlight(
|
|
340
341
|
$input: [AddQuestionHighlightInput!]!
|
|
341
342
|
$marksheetId: Int
|
|
342
343
|
) {
|
|
@@ -346,12 +347,7 @@ exports.ADD_QUESTION_HIGHLIGHT = (0, client_1.gql) `
|
|
|
346
347
|
questionId
|
|
347
348
|
userId
|
|
348
349
|
highlights {
|
|
349
|
-
|
|
350
|
-
end
|
|
351
|
-
text
|
|
352
|
-
part
|
|
353
|
-
tag
|
|
354
|
-
color
|
|
350
|
+
...HighlightFields
|
|
355
351
|
}
|
|
356
352
|
}
|
|
357
353
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { IFile } from './File';
|
|
2
|
+
import { IHighlightNode } from './Highlight';
|
|
3
|
+
import { IUserChapterNote } from './Note';
|
|
2
4
|
import { IPicture } from './Picture';
|
|
3
5
|
import { ETopicType } from './Topic';
|
|
4
6
|
import { Id } from './Type';
|
|
5
|
-
import { IUserChapterNote } from './User';
|
|
6
7
|
export interface IChapter {
|
|
7
8
|
id: Id;
|
|
8
9
|
createdAt: number | Date;
|
|
@@ -13,4 +14,5 @@ export interface IChapter {
|
|
|
13
14
|
pictures?: IPicture[];
|
|
14
15
|
files?: IFile[];
|
|
15
16
|
userNote: null | IUserChapterNote;
|
|
17
|
+
highlights?: IHighlightNode[];
|
|
16
18
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IChapter } from './Chapter';
|
|
2
|
+
import { IQuestion } from './Question';
|
|
3
|
+
import { Id } from './Type';
|
|
4
|
+
import { IUser } from './User';
|
|
5
|
+
export interface IHighlightNode {
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
text: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
part?: string;
|
|
11
|
+
tag?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IHighlight {
|
|
14
|
+
id: Id;
|
|
15
|
+
createdAt: number | Date;
|
|
16
|
+
updatedAt: number | Date;
|
|
17
|
+
deletedAt: number | Date;
|
|
18
|
+
userId?: Id;
|
|
19
|
+
user?: IUser;
|
|
20
|
+
highlights?: IHighlightNode[];
|
|
21
|
+
}
|
|
22
|
+
export interface IQuestionHighlight extends IHighlight {
|
|
23
|
+
questionId?: Id;
|
|
24
|
+
question?: IQuestion;
|
|
25
|
+
}
|
|
26
|
+
export interface IChapterHighlight extends IHighlight {
|
|
27
|
+
chapterId?: Id;
|
|
28
|
+
chapter?: IChapter;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IChapter } from './Chapter';
|
|
2
|
+
import { IOsceStation } from './OsceStation';
|
|
3
|
+
import { Id } from './Type';
|
|
4
|
+
export interface IUserNote {
|
|
5
|
+
id: Id;
|
|
6
|
+
createdAt: number | Date;
|
|
7
|
+
updatedAt: number | Date;
|
|
8
|
+
userId: Id;
|
|
9
|
+
note: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IUserChapterNote extends IUserNote {
|
|
12
|
+
chapterId: Id;
|
|
13
|
+
chapter: IChapter;
|
|
14
|
+
}
|
|
15
|
+
export interface IUserStationNote extends IUserNote {
|
|
16
|
+
stationId: Id;
|
|
17
|
+
station: IOsceStation;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IConcept } from './Concept';
|
|
2
2
|
import { EDifficultyType } from './Difficulty';
|
|
3
|
+
import { IUserStationNote } from './Note';
|
|
3
4
|
import { IPaceScore } from './Paces';
|
|
4
5
|
import { IPicture } from './Picture';
|
|
5
6
|
import { IEntitlement } from './Product';
|
|
@@ -70,6 +71,7 @@ export interface IOsceStation {
|
|
|
70
71
|
score?: number;
|
|
71
72
|
status?: EUserLearningStatus;
|
|
72
73
|
demo?: boolean;
|
|
74
|
+
userNote: null | IUserStationNote;
|
|
73
75
|
}
|
|
74
76
|
export interface IOsceStationTopic {
|
|
75
77
|
id: Id;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IConcept } from './Concept';
|
|
2
2
|
import { ICondition } from './Condition';
|
|
3
3
|
import { EDifficultyType } from './Difficulty';
|
|
4
|
+
import { IHighlightNode } from './Highlight';
|
|
4
5
|
import { IPicture } from './Picture';
|
|
5
6
|
import { IPresentation } from './Presentation';
|
|
6
7
|
import { ITopic } from './Topic';
|
|
@@ -90,26 +91,7 @@ export interface IQuestion {
|
|
|
90
91
|
dislikes?: number;
|
|
91
92
|
isLikedByMe?: EQuestionLike;
|
|
92
93
|
comments?: IQuestionComment[];
|
|
93
|
-
highlights?:
|
|
94
|
-
}
|
|
95
|
-
export interface IHighlight {
|
|
96
|
-
start: number;
|
|
97
|
-
end: number;
|
|
98
|
-
text: string;
|
|
99
|
-
color?: string;
|
|
100
|
-
part?: string;
|
|
101
|
-
tag?: string;
|
|
102
|
-
}
|
|
103
|
-
export interface IQuestionHighlights {
|
|
104
|
-
id: Id;
|
|
105
|
-
createdAt: number | Date;
|
|
106
|
-
updatedAt: number | Date;
|
|
107
|
-
deletedAt: number | Date;
|
|
108
|
-
userId?: Id;
|
|
109
|
-
questionId?: Id;
|
|
110
|
-
user?: IUser;
|
|
111
|
-
question?: IQuestion;
|
|
112
|
-
highlights?: Array<IHighlight>;
|
|
94
|
+
highlights?: IHighlightNode[];
|
|
113
95
|
}
|
|
114
96
|
export interface IQuestionChoice {
|
|
115
97
|
id: Id;
|
|
@@ -5,13 +5,12 @@ import { IMarksheet } from './Marksheet';
|
|
|
5
5
|
import { INotification } from './Notification';
|
|
6
6
|
import { IOsceStation } from './OsceStation';
|
|
7
7
|
import { EProductType } from './Product';
|
|
8
|
-
import { IQuestion
|
|
8
|
+
import { IQuestion } from './Question';
|
|
9
9
|
import { ISubscription } from './Subscription';
|
|
10
10
|
import { ITodo } from './Todo';
|
|
11
11
|
import { Id } from './Type';
|
|
12
12
|
import { IUniversity } from './University';
|
|
13
13
|
import { IVideo } from './Video';
|
|
14
|
-
import { IChapter } from './Chapter';
|
|
15
14
|
export type IUserSubsriptionDates = keyof ExtractKeysWithPattern<IPayload, 'EndDate'>;
|
|
16
15
|
export declare enum IAccessLevel {
|
|
17
16
|
SUBSCRIBER = "subscriber",
|
|
@@ -142,7 +141,6 @@ export interface IUser {
|
|
|
142
141
|
radiologyInterviewSubscriptionEndDate: number | Date | null;
|
|
143
142
|
plab1SubscriptionEndDate: number | Date | null;
|
|
144
143
|
plab2SubscriptionEndDate: number | Date | null;
|
|
145
|
-
questionHighlights?: IQuestionHighlights[];
|
|
146
144
|
}
|
|
147
145
|
export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear, compareUnix?: number): IClassYear;
|
|
148
146
|
export declare function currentClassGroup(createdAtUnix: number, classYear: IClassYear): EClassYearGroup;
|
|
@@ -157,15 +155,6 @@ export interface IUserCompletedQuestion {
|
|
|
157
155
|
question: IQuestion;
|
|
158
156
|
concept: IConcept;
|
|
159
157
|
}
|
|
160
|
-
export interface IUserChapterNote {
|
|
161
|
-
id: Id;
|
|
162
|
-
createdAt: number | Date;
|
|
163
|
-
updatedAt: number | Date;
|
|
164
|
-
chapterId: Id;
|
|
165
|
-
chapter: IChapter;
|
|
166
|
-
userId: Id;
|
|
167
|
-
note: string;
|
|
168
|
-
}
|
|
169
158
|
export interface IUserCompletedCard {
|
|
170
159
|
id: Id;
|
|
171
160
|
createdAt: number | Date;
|
|
@@ -8,8 +8,10 @@ export * from './Condition';
|
|
|
8
8
|
export * from './Difficulty';
|
|
9
9
|
export * from './Feedback';
|
|
10
10
|
export * from './File';
|
|
11
|
+
export * from './Highlight';
|
|
11
12
|
export * from './Marksheet';
|
|
12
13
|
export * from './MockTest';
|
|
14
|
+
export * from './Note';
|
|
13
15
|
export * from './Notification';
|
|
14
16
|
export * from './OsceMarksheet';
|
|
15
17
|
export * from './OsceStation';
|
package/dist/mjs/models/index.js
CHANGED
|
@@ -8,8 +8,10 @@ export * from './Condition';
|
|
|
8
8
|
export * from './Difficulty';
|
|
9
9
|
export * from './Feedback';
|
|
10
10
|
export * from './File';
|
|
11
|
+
export * from './Highlight';
|
|
11
12
|
export * from './Marksheet';
|
|
12
13
|
export * from './MockTest';
|
|
14
|
+
export * from './Note';
|
|
13
15
|
export * from './Notification';
|
|
14
16
|
export * from './OsceMarksheet';
|
|
15
17
|
export * from './OsceStation';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { PICTURE_FIELDS } from './picture';
|
|
3
|
+
import { HIGHLIGHT_FIELDS } from './highlight';
|
|
3
4
|
export const CHAPTER_FIELDS = gql `
|
|
4
5
|
${PICTURE_FIELDS}
|
|
6
|
+
${HIGHLIGHT_FIELDS}
|
|
5
7
|
fragment ChapterFields on Chapter {
|
|
6
8
|
id
|
|
7
9
|
explanation
|
|
@@ -9,6 +11,9 @@ export const CHAPTER_FIELDS = gql `
|
|
|
9
11
|
pictures {
|
|
10
12
|
...PictureFields
|
|
11
13
|
}
|
|
14
|
+
highlights {
|
|
15
|
+
...HighlightFields
|
|
16
|
+
}
|
|
12
17
|
userNote {
|
|
13
18
|
id
|
|
14
19
|
userId
|
|
@@ -25,6 +30,7 @@ export const CHAPTER_FIELDS = gql `
|
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
`;
|
|
33
|
+
// used in cache updator
|
|
28
34
|
export const UPSERT_CHAPTER_NOTE_FRAGMENT = gql `
|
|
29
35
|
fragment UpsertChapterNoteFragment on Chapter {
|
|
30
36
|
userNote {
|
|
@@ -36,3 +42,16 @@ export const UPSERT_CHAPTER_NOTE_FRAGMENT = gql `
|
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
`;
|
|
45
|
+
// used in cache updator
|
|
46
|
+
export const CHAPTER_WITH_HIGHLIGHT_FIELDS = gql `
|
|
47
|
+
fragment ChapterWithHighlightFields on Chapter {
|
|
48
|
+
highlights {
|
|
49
|
+
start
|
|
50
|
+
end
|
|
51
|
+
text
|
|
52
|
+
part
|
|
53
|
+
tag
|
|
54
|
+
color
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HIGHLIGHT_FIELDS: import("@apollo/client").DocumentNode;
|
|
@@ -6,3 +6,4 @@ export declare const OSCE_MATCHMAKING_ACTION_FIELDS: import("@apollo/client").Do
|
|
|
6
6
|
export declare const STATION_CONCEPT_FRAGMENT: import("@apollo/client").DocumentNode;
|
|
7
7
|
export declare const COMPLETED_OSCE_MARKSHEET_FRAGMENT: import("@apollo/client").DocumentNode;
|
|
8
8
|
export declare const COMPLETED_OSCE_STATION_FRAGMENT: import("@apollo/client").DocumentNode;
|
|
9
|
+
export declare const UPSERT_STATION_NOTE_FRAGMENT: import("@apollo/client").DocumentNode;
|
|
@@ -169,3 +169,15 @@ export const COMPLETED_OSCE_STATION_FRAGMENT = gql `
|
|
|
169
169
|
lastOsceMarksheetId
|
|
170
170
|
}
|
|
171
171
|
`;
|
|
172
|
+
// used in cache updator
|
|
173
|
+
export const UPSERT_STATION_NOTE_FRAGMENT = gql `
|
|
174
|
+
fragment UpsertStationNoteFragment on OsceStation {
|
|
175
|
+
userNote {
|
|
176
|
+
userId
|
|
177
|
+
stationId
|
|
178
|
+
note
|
|
179
|
+
createdAt
|
|
180
|
+
updatedAt
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { CONCEPT_FIELDS } from './concept';
|
|
3
|
+
import { HIGHLIGHT_FIELDS } from './highlight';
|
|
3
4
|
import { PICTURE_FIELDS } from './picture';
|
|
4
5
|
export const QUESTION_COMMENT_FIELDS = gql `
|
|
5
6
|
fragment QuestionCommentFields on QuestionComment {
|
|
@@ -95,6 +96,7 @@ export const QUESTION_CATEGORY_FIELDS = gql `
|
|
|
95
96
|
}
|
|
96
97
|
`;
|
|
97
98
|
export const QUESTION_FIELDS = gql `
|
|
99
|
+
${HIGHLIGHT_FIELDS}
|
|
98
100
|
${QUESTION_CATEGORY_FIELDS}
|
|
99
101
|
${QUESTION_COMMENT_FIELDS}
|
|
100
102
|
${CONCEPT_FIELDS}
|
|
@@ -112,12 +114,7 @@ export const QUESTION_FIELDS = gql `
|
|
|
112
114
|
typeId
|
|
113
115
|
psaSectionId
|
|
114
116
|
highlights {
|
|
115
|
-
|
|
116
|
-
end
|
|
117
|
-
text
|
|
118
|
-
part
|
|
119
|
-
tag
|
|
120
|
-
color
|
|
117
|
+
...HighlightFields
|
|
121
118
|
}
|
|
122
119
|
choices {
|
|
123
120
|
id
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { IUserChapterNote } from '../../../models';
|
|
2
|
+
import { IChapterHighlight, IHighlightNode, IUserChapterNote, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
|
-
import { RestrictedData } from '../../types';
|
|
4
|
+
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
|
+
/**
|
|
6
|
+
* upsertChapterNote
|
|
7
|
+
*/
|
|
5
8
|
export declare const UPSERT_CHAPTER_NOTE: import("@apollo/client").DocumentNode;
|
|
6
9
|
export interface IUpsertChapterNoteVar {
|
|
7
10
|
chapterId: number;
|
|
@@ -23,3 +26,16 @@ export declare const optimisticUpsertChapterNote: (data: IUpsertChapterNoteVar &
|
|
|
23
26
|
};
|
|
24
27
|
};
|
|
25
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* addChapterHighlight
|
|
31
|
+
*/
|
|
32
|
+
export interface IAddChapterHighlightVar {
|
|
33
|
+
marksheetId?: number;
|
|
34
|
+
input: {
|
|
35
|
+
chapterId: Id;
|
|
36
|
+
highlights: IHighlightNode[];
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
39
|
+
export type IAddChapterHighlightData = RestrictedData<(graphqlNormalize & IChapterHighlight)[], 'addChapterHighlight'>;
|
|
40
|
+
export declare const ADD_CHAPTER_HIGHLIGHT: import("@apollo/client").DocumentNode;
|
|
41
|
+
export declare const updateChapterHighlights: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddChapterHighlightData>, options: ApolloUpdateOptions<IAddChapterHighlightVar>) => void;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
|
-
import { UPSERT_CHAPTER_NOTE_FRAGMENT } from '../../fragments';
|
|
2
|
+
import { CHAPTER_WITH_HIGHLIGHT_FIELDS, HIGHLIGHT_FIELDS, UPSERT_CHAPTER_NOTE_FRAGMENT, } from '../../fragments';
|
|
3
|
+
/**
|
|
4
|
+
* upsertChapterNote
|
|
5
|
+
*/
|
|
3
6
|
export const UPSERT_CHAPTER_NOTE = gql `
|
|
4
7
|
mutation UpsertChapterNote($chapterId: Int!, $note: String!) {
|
|
5
8
|
restricted {
|
|
@@ -43,3 +46,45 @@ export const optimisticUpsertChapterNote = (data) => {
|
|
|
43
46
|
},
|
|
44
47
|
};
|
|
45
48
|
};
|
|
49
|
+
export const ADD_CHAPTER_HIGHLIGHT = gql `
|
|
50
|
+
${HIGHLIGHT_FIELDS}
|
|
51
|
+
mutation AddChapterHighlight(
|
|
52
|
+
$input: [AddChapterHighlightInput!]!
|
|
53
|
+
$marksheetId: Int
|
|
54
|
+
) {
|
|
55
|
+
restricted {
|
|
56
|
+
addChapterHighlight(input: $input, marksheetId: $marksheetId) {
|
|
57
|
+
id
|
|
58
|
+
chapterId
|
|
59
|
+
userId
|
|
60
|
+
highlights {
|
|
61
|
+
...HighlightFields
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
export const updateChapterHighlights = (cache, result, options) => {
|
|
68
|
+
const { addChapterHighlight } = result?.data?.restricted ?? {};
|
|
69
|
+
const { variables } = options || {};
|
|
70
|
+
if (!variables || !addChapterHighlight) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
for (const { chapterId, highlights } of variables.input) {
|
|
75
|
+
cache.writeFragment({
|
|
76
|
+
id: cache.identify({
|
|
77
|
+
id: chapterId,
|
|
78
|
+
__typename: 'Chapter',
|
|
79
|
+
}),
|
|
80
|
+
data: {
|
|
81
|
+
highlights,
|
|
82
|
+
},
|
|
83
|
+
fragment: CHAPTER_WITH_HIGHLIGHT_FIELDS,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
console.error(error);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { EOsceMarksheetAction, EOsceMarksheetState, EOsceRoles, EPaceMarkType, EProductType, EStudyAction, IOsceMarksheet, IOsceMarksheetMark, Id } from '../../../models';
|
|
2
|
+
import { EOsceMarksheetAction, EOsceMarksheetState, EOsceRoles, EPaceMarkType, EProductType, EStudyAction, IOsceMarksheet, IOsceMarksheetMark, IUserStationNote, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { IOsceMatchmakingAction } from '../../subscription/osce';
|
|
5
5
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
@@ -140,3 +140,27 @@ export interface ILeaveOsceMarksheetVar {
|
|
|
140
140
|
osceMarksheetId: Id;
|
|
141
141
|
}
|
|
142
142
|
export type ILeaveOsceMarksheetData = RestrictedData<graphqlNormalize & IOsceMarksheet, 'leaveOsceMarksheet'>;
|
|
143
|
+
/**
|
|
144
|
+
* upsertStationNote
|
|
145
|
+
*/
|
|
146
|
+
export declare const UPSERT_STATION_NOTE: import("@apollo/client").DocumentNode;
|
|
147
|
+
export interface IUpsertStationNoteVar {
|
|
148
|
+
stationId: number;
|
|
149
|
+
note: string;
|
|
150
|
+
}
|
|
151
|
+
export type IUpsertStationNoteData = RestrictedData<IUserStationNote, 'upsertStationNote'>;
|
|
152
|
+
export declare const updateCacheOnUpsertStationNote: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertStationNoteData>, options: ApolloUpdateOptions<IUpsertStationNoteVar>) => void;
|
|
153
|
+
export declare const optimisticUpsertStationNote: (data: IUpsertStationNoteVar & {
|
|
154
|
+
userId: number;
|
|
155
|
+
}) => {
|
|
156
|
+
restricted: {
|
|
157
|
+
upsertStationNote: {
|
|
158
|
+
createdAt: Date;
|
|
159
|
+
updatedAt: Date;
|
|
160
|
+
stationId: number;
|
|
161
|
+
note: string;
|
|
162
|
+
userId: number;
|
|
163
|
+
__typename: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { EProductType, } from '../../../models';
|
|
3
|
-
import { COMPLETED_OSCE_MARKSHEET_FRAGMENT, COMPLETED_OSCE_STATION_FRAGMENT, OSCE_MARKSHEET_FIELDS, OSCE_MATCHMAKING_ACTION_FIELDS, } from '../../fragments
|
|
4
|
-
import { OSCE_STATION_FIELDS } from './../../fragments/osce';
|
|
3
|
+
import { OSCE_STATION_FIELDS, COMPLETED_OSCE_MARKSHEET_FRAGMENT, COMPLETED_OSCE_STATION_FRAGMENT, OSCE_MARKSHEET_FIELDS, OSCE_MATCHMAKING_ACTION_FIELDS, UPSERT_STATION_NOTE_FRAGMENT, } from '../../fragments';
|
|
5
4
|
export const START_OSCE_MATCHMAKING = gql `
|
|
6
5
|
mutation StartOsceMatchmaking($sessionId: String!) {
|
|
7
6
|
restricted {
|
|
@@ -290,3 +289,49 @@ export const LEAVE_OSCE_MARKSHEET = gql `
|
|
|
290
289
|
}
|
|
291
290
|
}
|
|
292
291
|
`;
|
|
292
|
+
/**
|
|
293
|
+
* upsertStationNote
|
|
294
|
+
*/
|
|
295
|
+
export const UPSERT_STATION_NOTE = gql `
|
|
296
|
+
mutation UpsertStationNote($stationId: Int!, $note: String!) {
|
|
297
|
+
restricted {
|
|
298
|
+
upsertStationNote(stationId: $stationId, note: $note) {
|
|
299
|
+
id
|
|
300
|
+
stationId
|
|
301
|
+
userId
|
|
302
|
+
note
|
|
303
|
+
createdAt
|
|
304
|
+
updatedAt
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
`;
|
|
309
|
+
export const updateCacheOnUpsertStationNote = (cache, result, options) => {
|
|
310
|
+
const { upsertStationNote } = result?.data?.restricted || {};
|
|
311
|
+
const { variables } = options || {};
|
|
312
|
+
if (!variables || !upsertStationNote) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
cache.writeFragment({
|
|
316
|
+
id: cache.identify({
|
|
317
|
+
id: variables.stationId,
|
|
318
|
+
__typename: 'OsceStation',
|
|
319
|
+
}),
|
|
320
|
+
data: {
|
|
321
|
+
userNote: upsertStationNote,
|
|
322
|
+
},
|
|
323
|
+
fragment: UPSERT_STATION_NOTE_FRAGMENT,
|
|
324
|
+
});
|
|
325
|
+
};
|
|
326
|
+
export const optimisticUpsertStationNote = (data) => {
|
|
327
|
+
return {
|
|
328
|
+
restricted: {
|
|
329
|
+
upsertStationNote: {
|
|
330
|
+
__typename: 'UserStationNote',
|
|
331
|
+
...data,
|
|
332
|
+
createdAt: new Date(),
|
|
333
|
+
updatedAt: new Date(),
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
2
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
|
|
3
|
-
import { EQuestionLike, EQuestionType, IAccessLevel,
|
|
3
|
+
import { EQuestionLike, EQuestionType, IAccessLevel, IHighlightNode, IQuestion, IQuestionComment, IQuestionHighlight, Id } from '../../../models';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
5
|
interface LikeData {
|
|
6
6
|
likes?: number;
|
|
@@ -56,10 +56,10 @@ export interface IAddQuestionHighlightVar {
|
|
|
56
56
|
marksheetId?: number;
|
|
57
57
|
input: {
|
|
58
58
|
questionId: Id;
|
|
59
|
-
highlights:
|
|
59
|
+
highlights: IHighlightNode[];
|
|
60
60
|
}[];
|
|
61
61
|
}
|
|
62
|
-
export type IAddQuestionHighlightData = RestrictedData<(graphqlNormalize &
|
|
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
65
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { DateTime } from 'luxon';
|
|
3
3
|
import { EQuestionLike, EQuestionType, } from '../../../models';
|
|
4
|
-
import { QUESTION_COMMENT_FIELDS, QUESTION_WITH_COMMENT_FIELDS, QUESTION_WITH_HIGHLIGHT_FIELDS, } from '../../fragments';
|
|
4
|
+
import { HIGHLIGHT_FIELDS, QUESTION_COMMENT_FIELDS, QUESTION_WITH_COMMENT_FIELDS, QUESTION_WITH_HIGHLIGHT_FIELDS, } from '../../fragments';
|
|
5
5
|
export const getLikeData = (like, item) => {
|
|
6
6
|
let { likes = 0, dislikes = 0, isLikedByMe } = item;
|
|
7
7
|
if (isLikedByMe === EQuestionLike.LIKE) {
|
|
@@ -325,7 +325,8 @@ export const optimisticQuestionCommentRemove = (comments, input, parentId) => {
|
|
|
325
325
|
};
|
|
326
326
|
};
|
|
327
327
|
export const ADD_QUESTION_HIGHLIGHT = gql `
|
|
328
|
-
|
|
328
|
+
${HIGHLIGHT_FIELDS}
|
|
329
|
+
mutation AddQuestionHighlight(
|
|
329
330
|
$input: [AddQuestionHighlightInput!]!
|
|
330
331
|
$marksheetId: Int
|
|
331
332
|
) {
|
|
@@ -335,12 +336,7 @@ export const ADD_QUESTION_HIGHLIGHT = gql `
|
|
|
335
336
|
questionId
|
|
336
337
|
userId
|
|
337
338
|
highlights {
|
|
338
|
-
|
|
339
|
-
end
|
|
340
|
-
text
|
|
341
|
-
part
|
|
342
|
-
tag
|
|
343
|
-
color
|
|
339
|
+
...HighlightFields
|
|
344
340
|
}
|
|
345
341
|
}
|
|
346
342
|
}
|