@quesmed/types-rn 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.
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
+ }
package/models/Note.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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?: Array<IHighlight>;
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;
package/models/User.d.ts CHANGED
@@ -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, IQuestionHighlights } from './Question';
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;
package/models/index.d.ts 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';
package/models/index.js CHANGED
@@ -24,8 +24,10 @@ __exportStar(require("./Condition"), exports);
24
24
  __exportStar(require("./Difficulty"), exports);
25
25
  __exportStar(require("./Feedback"), exports);
26
26
  __exportStar(require("./File"), exports);
27
+ __exportStar(require("./Highlight"), exports);
27
28
  __exportStar(require("./Marksheet"), exports);
28
29
  __exportStar(require("./MockTest"), exports);
30
+ __exportStar(require("./Note"), exports);
29
31
  __exportStar(require("./Notification"), exports);
30
32
  __exportStar(require("./OsceMarksheet"), exports);
31
33
  __exportStar(require("./OsceStation"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.6.55",
3
+ "version": "2.6.57",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -1,2 +1,3 @@
1
1
  export declare const CHAPTER_FIELDS: import("@apollo/client").DocumentNode;
2
2
  export declare const UPSERT_CHAPTER_NOTE_FRAGMENT: import("@apollo/client").DocumentNode;
3
+ export declare const CHAPTER_WITH_HIGHLIGHT_FIELDS: import("@apollo/client").DocumentNode;
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UPSERT_CHAPTER_NOTE_FRAGMENT = exports.CHAPTER_FIELDS = void 0;
3
+ exports.CHAPTER_WITH_HIGHLIGHT_FIELDS = exports.UPSERT_CHAPTER_NOTE_FRAGMENT = exports.CHAPTER_FIELDS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const picture_1 = require("./picture");
6
+ const highlight_1 = require("./highlight");
6
7
  exports.CHAPTER_FIELDS = (0, client_1.gql) `
7
8
  ${picture_1.PICTURE_FIELDS}
9
+ ${highlight_1.HIGHLIGHT_FIELDS}
8
10
  fragment ChapterFields on Chapter {
9
11
  id
10
12
  explanation
@@ -12,6 +14,9 @@ exports.CHAPTER_FIELDS = (0, client_1.gql) `
12
14
  pictures {
13
15
  ...PictureFields
14
16
  }
17
+ highlights {
18
+ ...HighlightFields
19
+ }
15
20
  userNote {
16
21
  id
17
22
  userId
@@ -28,6 +33,7 @@ exports.CHAPTER_FIELDS = (0, client_1.gql) `
28
33
  }
29
34
  }
30
35
  `;
36
+ // used in cache updator
31
37
  exports.UPSERT_CHAPTER_NOTE_FRAGMENT = (0, client_1.gql) `
32
38
  fragment UpsertChapterNoteFragment on Chapter {
33
39
  userNote {
@@ -39,3 +45,16 @@ exports.UPSERT_CHAPTER_NOTE_FRAGMENT = (0, client_1.gql) `
39
45
  }
40
46
  }
41
47
  `;
48
+ // used in cache updator
49
+ exports.CHAPTER_WITH_HIGHLIGHT_FIELDS = (0, client_1.gql) `
50
+ fragment ChapterWithHighlightFields on Chapter {
51
+ highlights {
52
+ start
53
+ end
54
+ text
55
+ part
56
+ tag
57
+ color
58
+ }
59
+ }
60
+ `;
@@ -0,0 +1 @@
1
+ export declare const HIGHLIGHT_FIELDS: import("@apollo/client").DocumentNode;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HIGHLIGHT_FIELDS = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ exports.HIGHLIGHT_FIELDS = (0, client_1.gql) `
6
+ fragment HighlightFields on HighlightNode {
7
+ start
8
+ end
9
+ text
10
+ part
11
+ tag
12
+ color
13
+ }
14
+ `;
@@ -1,6 +1,7 @@
1
1
  export * from './blog';
2
2
  export * from './chapter';
3
3
  export * from './concept';
4
+ export * from './highlight';
4
5
  export * from './marksheet';
5
6
  export * from './mockTest';
6
7
  export * from './osce';
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./blog"), exports);
18
18
  __exportStar(require("./chapter"), exports);
19
19
  __exportStar(require("./concept"), exports);
20
+ __exportStar(require("./highlight"), exports);
20
21
  __exportStar(require("./marksheet"), exports);
21
22
  __exportStar(require("./mockTest"), exports);
22
23
  __exportStar(require("./osce"), exports);
@@ -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;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.COMPLETED_OSCE_STATION_FRAGMENT = exports.COMPLETED_OSCE_MARKSHEET_FRAGMENT = exports.STATION_CONCEPT_FRAGMENT = exports.OSCE_MATCHMAKING_ACTION_FIELDS = exports.OSCE_MARKSHEET_FIELDS = exports.OSCE_MARKSHEET_MARK_FIELDS = exports.OSCE_STATION_FIELDS = exports.OSCE_STATION_MARK_FIELDS = void 0;
3
+ exports.UPSERT_STATION_NOTE_FRAGMENT = exports.COMPLETED_OSCE_STATION_FRAGMENT = exports.COMPLETED_OSCE_MARKSHEET_FRAGMENT = exports.STATION_CONCEPT_FRAGMENT = exports.OSCE_MATCHMAKING_ACTION_FIELDS = exports.OSCE_MARKSHEET_FIELDS = exports.OSCE_MARKSHEET_MARK_FIELDS = exports.OSCE_STATION_FIELDS = exports.OSCE_STATION_MARK_FIELDS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const picture_1 = require("./picture");
6
6
  const video_1 = require("./video");
@@ -172,3 +172,15 @@ exports.COMPLETED_OSCE_STATION_FRAGMENT = (0, client_1.gql) `
172
172
  lastOsceMarksheetId
173
173
  }
174
174
  `;
175
+ // used in cache updator
176
+ exports.UPSERT_STATION_NOTE_FRAGMENT = (0, client_1.gql) `
177
+ fragment UpsertStationNoteFragment on OsceStation {
178
+ userNote {
179
+ userId
180
+ stationId
181
+ note
182
+ createdAt
183
+ updatedAt
184
+ }
185
+ }
186
+ `;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  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
+ const highlight_1 = require("./highlight");
6
7
  const picture_1 = require("./picture");
7
8
  exports.QUESTION_COMMENT_FIELDS = (0, client_1.gql) `
8
9
  fragment QuestionCommentFields on QuestionComment {
@@ -98,6 +99,7 @@ exports.QUESTION_CATEGORY_FIELDS = (0, client_1.gql) `
98
99
  }
99
100
  `;
100
101
  exports.QUESTION_FIELDS = (0, client_1.gql) `
102
+ ${highlight_1.HIGHLIGHT_FIELDS}
101
103
  ${exports.QUESTION_CATEGORY_FIELDS}
102
104
  ${exports.QUESTION_COMMENT_FIELDS}
103
105
  ${concept_1.CONCEPT_FIELDS}
@@ -115,12 +117,7 @@ exports.QUESTION_FIELDS = (0, client_1.gql) `
115
117
  typeId
116
118
  psaSectionId
117
119
  highlights {
118
- start
119
- end
120
- text
121
- part
122
- tag
123
- color
120
+ ...HighlightFields
124
121
  }
125
122
  choices {
126
123
  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,8 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optimisticUpsertChapterNote = exports.updateCacheOnUpsertChapterNote = exports.UPSERT_CHAPTER_NOTE = void 0;
3
+ exports.updateChapterHighlights = exports.ADD_CHAPTER_HIGHLIGHT = exports.optimisticUpsertChapterNote = exports.updateCacheOnUpsertChapterNote = exports.UPSERT_CHAPTER_NOTE = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const fragments_1 = require("../../fragments");
6
+ /**
7
+ * upsertChapterNote
8
+ */
6
9
  exports.UPSERT_CHAPTER_NOTE = (0, client_1.gql) `
7
10
  mutation UpsertChapterNote($chapterId: Int!, $note: String!) {
8
11
  restricted {
@@ -48,3 +51,46 @@ const optimisticUpsertChapterNote = (data) => {
48
51
  };
49
52
  };
50
53
  exports.optimisticUpsertChapterNote = optimisticUpsertChapterNote;
54
+ exports.ADD_CHAPTER_HIGHLIGHT = (0, client_1.gql) `
55
+ ${fragments_1.HIGHLIGHT_FIELDS}
56
+ mutation AddChapterHighlight(
57
+ $input: [AddChapterHighlightInput!]!
58
+ $marksheetId: Int
59
+ ) {
60
+ restricted {
61
+ addChapterHighlight(input: $input, marksheetId: $marksheetId) {
62
+ id
63
+ chapterId
64
+ userId
65
+ highlights {
66
+ ...HighlightFields
67
+ }
68
+ }
69
+ }
70
+ }
71
+ `;
72
+ const updateChapterHighlights = (cache, result, options) => {
73
+ const { addChapterHighlight } = result?.data?.restricted ?? {};
74
+ const { variables } = options || {};
75
+ if (!variables || !addChapterHighlight) {
76
+ return;
77
+ }
78
+ try {
79
+ for (const { chapterId, highlights } of variables.input) {
80
+ cache.writeFragment({
81
+ id: cache.identify({
82
+ id: chapterId,
83
+ __typename: 'Chapter',
84
+ }),
85
+ data: {
86
+ highlights,
87
+ },
88
+ fragment: fragments_1.CHAPTER_WITH_HIGHLIGHT_FIELDS,
89
+ });
90
+ }
91
+ }
92
+ catch (error) {
93
+ console.error(error);
94
+ }
95
+ };
96
+ exports.updateChapterHighlights = updateChapterHighlights;
@@ -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,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LEAVE_OSCE_MARKSHEET = exports.optimisticEndOsceMarksheet = exports.updateCacheOnEndOsceMarksheet = exports.END_OSCE_MARKSHEET = exports.MODIFY_OSCE_MARKSHEET = exports.SAVE_OSCE_MARKSHEET = exports.PRESTART_OSCE_MARKSHEET = exports.START_OSCE_TIMER = exports.START_OSCE_MARKSHEET = exports.SELECT_OSCE_STATION = exports.optimisticMarkOsceMarksheetMark = exports.MARK_OSCE_MARKSHEET_MARK = exports.CHANGE_OSCE_ROLE = exports.BUILD_OSCE_MARKSHEET = exports.CREATE_OR_JOIN_OSCE_MARKSHEET = exports.CANCEL_OSCE_MATCHMAKING = exports.CHECK_OSCE_MATCHMAKING = exports.ACCEPT_OSCE_MATCHMAKING = exports.START_OSCE_MATCHMAKING = void 0;
3
+ exports.optimisticUpsertStationNote = exports.updateCacheOnUpsertStationNote = exports.UPSERT_STATION_NOTE = exports.LEAVE_OSCE_MARKSHEET = exports.optimisticEndOsceMarksheet = exports.updateCacheOnEndOsceMarksheet = exports.END_OSCE_MARKSHEET = exports.MODIFY_OSCE_MARKSHEET = exports.SAVE_OSCE_MARKSHEET = exports.PRESTART_OSCE_MARKSHEET = exports.START_OSCE_TIMER = exports.START_OSCE_MARKSHEET = exports.SELECT_OSCE_STATION = exports.optimisticMarkOsceMarksheetMark = exports.MARK_OSCE_MARKSHEET_MARK = exports.CHANGE_OSCE_ROLE = exports.BUILD_OSCE_MARKSHEET = exports.CREATE_OR_JOIN_OSCE_MARKSHEET = exports.CANCEL_OSCE_MATCHMAKING = exports.CHECK_OSCE_MATCHMAKING = exports.ACCEPT_OSCE_MATCHMAKING = exports.START_OSCE_MATCHMAKING = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const models_1 = require("../../../models");
6
- const osce_1 = require("../../fragments/osce");
7
- const osce_2 = require("./../../fragments/osce");
6
+ const fragments_1 = require("../../fragments");
8
7
  exports.START_OSCE_MATCHMAKING = (0, client_1.gql) `
9
8
  mutation StartOsceMatchmaking($sessionId: String!) {
10
9
  restricted {
@@ -20,7 +19,7 @@ exports.ACCEPT_OSCE_MATCHMAKING = (0, client_1.gql) `
20
19
  }
21
20
  `;
22
21
  exports.CHECK_OSCE_MATCHMAKING = (0, client_1.gql) `
23
- ${osce_1.OSCE_MATCHMAKING_ACTION_FIELDS}
22
+ ${fragments_1.OSCE_MATCHMAKING_ACTION_FIELDS}
24
23
  mutation CheckOsceMatchmaking {
25
24
  restricted {
26
25
  checkOsceMatchmaking {
@@ -37,8 +36,8 @@ exports.CANCEL_OSCE_MATCHMAKING = (0, client_1.gql) `
37
36
  }
38
37
  `;
39
38
  exports.CREATE_OR_JOIN_OSCE_MARKSHEET = (0, client_1.gql) `
40
- ${osce_2.OSCE_STATION_FIELDS}
41
- ${osce_1.OSCE_MARKSHEET_FIELDS}
39
+ ${fragments_1.OSCE_STATION_FIELDS}
40
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
42
41
  mutation CreateOrJoinOsceMarksheet($sessionId: String!, $action: Int!) {
43
42
  restricted {
44
43
  createOrJoinOsceMarksheet(sessionId: $sessionId, action: $action) {
@@ -51,8 +50,8 @@ exports.CREATE_OR_JOIN_OSCE_MARKSHEET = (0, client_1.gql) `
51
50
  }
52
51
  `;
53
52
  exports.BUILD_OSCE_MARKSHEET = (0, client_1.gql) `
54
- ${osce_2.OSCE_STATION_FIELDS}
55
- ${osce_1.OSCE_MARKSHEET_FIELDS}
53
+ ${fragments_1.OSCE_STATION_FIELDS}
54
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
56
55
  mutation BuildOsceMarksheet($osceStationId: Int!, $osceMarksheetId: Int) {
57
56
  restricted {
58
57
  buildOsceMarksheet(
@@ -68,7 +67,7 @@ exports.BUILD_OSCE_MARKSHEET = (0, client_1.gql) `
68
67
  }
69
68
  `;
70
69
  exports.CHANGE_OSCE_ROLE = (0, client_1.gql) `
71
- ${osce_1.OSCE_MARKSHEET_FIELDS}
70
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
72
71
  mutation ChangeOsceRole($sessionId: String!, $role: Int!) {
73
72
  restricted {
74
73
  changeOsceRole(sessionId: $sessionId, role: $role) {
@@ -113,8 +112,8 @@ const optimisticMarkOsceMarksheetMark = (variables, productType) => {
113
112
  };
114
113
  exports.optimisticMarkOsceMarksheetMark = optimisticMarkOsceMarksheetMark;
115
114
  exports.SELECT_OSCE_STATION = (0, client_1.gql) `
116
- ${osce_2.OSCE_STATION_FIELDS}
117
- ${osce_1.OSCE_MARKSHEET_FIELDS}
115
+ ${fragments_1.OSCE_STATION_FIELDS}
116
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
118
117
  mutation SelectOsceMarksheetStation(
119
118
  $osceMarksheetId: Int!
120
119
  $osceStationId: Int!
@@ -133,8 +132,8 @@ exports.SELECT_OSCE_STATION = (0, client_1.gql) `
133
132
  }
134
133
  `;
135
134
  exports.START_OSCE_MARKSHEET = (0, client_1.gql) `
136
- ${osce_2.OSCE_STATION_FIELDS}
137
- ${osce_1.OSCE_MARKSHEET_FIELDS}
135
+ ${fragments_1.OSCE_STATION_FIELDS}
136
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
138
137
  mutation StartOsceMarksheet($osceMarksheetId: Int!) {
139
138
  restricted {
140
139
  startOsceMarksheet(osceMarksheetId: $osceMarksheetId) {
@@ -162,8 +161,8 @@ exports.START_OSCE_TIMER = (0, client_1.gql) `
162
161
  }
163
162
  `;
164
163
  exports.PRESTART_OSCE_MARKSHEET = (0, client_1.gql) `
165
- ${osce_2.OSCE_STATION_FIELDS}
166
- ${osce_1.OSCE_MARKSHEET_FIELDS}
164
+ ${fragments_1.OSCE_STATION_FIELDS}
165
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
167
166
  mutation PrestartOsceMarksheet(
168
167
  $osceMarksheetId: Int!
169
168
  $readingTime: Int!
@@ -188,7 +187,7 @@ exports.PRESTART_OSCE_MARKSHEET = (0, client_1.gql) `
188
187
  }
189
188
  `;
190
189
  exports.SAVE_OSCE_MARKSHEET = (0, client_1.gql) `
191
- ${osce_1.OSCE_MARKSHEET_FIELDS}
190
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
192
191
  mutation SaveOsceMarksheet(
193
192
  $osceMarksheetId: Int!
194
193
  $feedback: String
@@ -221,7 +220,7 @@ exports.MODIFY_OSCE_MARKSHEET = (0, client_1.gql) `
221
220
  }
222
221
  `;
223
222
  exports.END_OSCE_MARKSHEET = (0, client_1.gql) `
224
- ${osce_1.OSCE_MARKSHEET_FIELDS}
223
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
225
224
  mutation EndOsceMarksheet(
226
225
  $osceMarksheetId: Int!
227
226
  $feedback: String
@@ -257,7 +256,7 @@ const updateCacheOnEndOsceMarksheet = (productType) => (cache, result, options)
257
256
  timeTaken: endOsceMarksheet.timeTaken,
258
257
  endedAt: endOsceMarksheet.endedAt,
259
258
  },
260
- fragment: osce_1.COMPLETED_OSCE_MARKSHEET_FRAGMENT,
259
+ fragment: fragments_1.COMPLETED_OSCE_MARKSHEET_FRAGMENT,
261
260
  });
262
261
  cache.writeFragment({
263
262
  id: cache.identify({
@@ -271,7 +270,7 @@ const updateCacheOnEndOsceMarksheet = (productType) => (cache, result, options)
271
270
  score: endOsceMarksheet.score,
272
271
  lastOsceMarksheetId: endOsceMarksheet.id,
273
272
  },
274
- fragment: osce_1.COMPLETED_OSCE_STATION_FRAGMENT,
273
+ fragment: fragments_1.COMPLETED_OSCE_STATION_FRAGMENT,
275
274
  });
276
275
  };
277
276
  exports.updateCacheOnEndOsceMarksheet = updateCacheOnEndOsceMarksheet;
@@ -287,7 +286,7 @@ const optimisticEndOsceMarksheet = (marksheet) => ({
287
286
  });
288
287
  exports.optimisticEndOsceMarksheet = optimisticEndOsceMarksheet;
289
288
  exports.LEAVE_OSCE_MARKSHEET = (0, client_1.gql) `
290
- ${osce_1.OSCE_MARKSHEET_FIELDS}
289
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
291
290
  mutation LeaveOsceMarksheet($osceMarksheetId: Int!) {
292
291
  restricted {
293
292
  leaveOsceMarksheet(osceMarksheetId: $osceMarksheetId) {
@@ -296,3 +295,51 @@ exports.LEAVE_OSCE_MARKSHEET = (0, client_1.gql) `
296
295
  }
297
296
  }
298
297
  `;
298
+ /**
299
+ * upsertStationNote
300
+ */
301
+ exports.UPSERT_STATION_NOTE = (0, client_1.gql) `
302
+ mutation UpsertStationNote($stationId: Int!, $note: String!) {
303
+ restricted {
304
+ upsertStationNote(stationId: $stationId, note: $note) {
305
+ id
306
+ stationId
307
+ userId
308
+ note
309
+ createdAt
310
+ updatedAt
311
+ }
312
+ }
313
+ }
314
+ `;
315
+ const updateCacheOnUpsertStationNote = (cache, result, options) => {
316
+ const { upsertStationNote } = result?.data?.restricted || {};
317
+ const { variables } = options || {};
318
+ if (!variables || !upsertStationNote) {
319
+ return;
320
+ }
321
+ cache.writeFragment({
322
+ id: cache.identify({
323
+ id: variables.stationId,
324
+ __typename: 'OsceStation',
325
+ }),
326
+ data: {
327
+ userNote: upsertStationNote,
328
+ },
329
+ fragment: fragments_1.UPSERT_STATION_NOTE_FRAGMENT,
330
+ });
331
+ };
332
+ exports.updateCacheOnUpsertStationNote = updateCacheOnUpsertStationNote;
333
+ const optimisticUpsertStationNote = (data) => {
334
+ return {
335
+ restricted: {
336
+ upsertStationNote: {
337
+ __typename: 'UserStationNote',
338
+ ...data,
339
+ createdAt: new Date(),
340
+ updatedAt: new Date(),
341
+ },
342
+ },
343
+ };
344
+ };
345
+ exports.optimisticUpsertStationNote = optimisticUpsertStationNote;
@@ -1,6 +1,6 @@
1
1
  import { ApolloCache } from '@apollo/client';
2
2
  import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
3
- import { EQuestionLike, EQuestionType, IAccessLevel, IHighlight, IQuestion, IQuestionComment, IQuestionHighlights, Id } from '../../../models';
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: IHighlight[];
59
+ highlights: IHighlightNode[];
60
60
  }[];
61
61
  }
62
- export type IAddQuestionHighlightData = RestrictedData<(graphqlNormalize & IQuestionHighlights)[], 'addQuestionHighlight'>;
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 {};
@@ -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
- mutation AddHighlight(
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
- start
350
- end
351
- text
352
- part
353
- tag
354
- color
350
+ ...HighlightFields
355
351
  }
356
352
  }
357
353
  }