@quesmed/types 2.6.76 → 2.6.78
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 +0 -2
- package/dist/cjs/models/Concept.d.ts +2 -0
- package/dist/cjs/models/Note.d.ts +4 -4
- package/dist/cjs/resolvers/fragments/chapter.d.ts +0 -1
- package/dist/cjs/resolvers/fragments/chapter.js +1 -20
- package/dist/cjs/resolvers/fragments/concept.d.ts +1 -0
- package/dist/cjs/resolvers/fragments/concept.js +20 -1
- package/dist/cjs/resolvers/mutation/restricted/chapter.d.ts +1 -15
- package/dist/cjs/resolvers/mutation/restricted/chapter.js +1 -59
- package/dist/cjs/resolvers/mutation/restricted/index.d.ts +1 -0
- package/dist/cjs/resolvers/mutation/restricted/index.js +1 -0
- package/dist/cjs/resolvers/mutation/restricted/notes.d.ts +31 -0
- package/dist/cjs/resolvers/mutation/restricted/notes.js +114 -0
- package/dist/cjs/resolvers/mutation/restricted/osce.d.ts +1 -14
- package/dist/cjs/resolvers/mutation/restricted/osce.js +1 -51
- package/dist/cjs/resolvers/query/restricted/concepts.js +7 -0
- package/dist/cjs/resolvers/query/restricted/index.d.ts +1 -0
- package/dist/cjs/resolvers/query/restricted/index.js +1 -0
- package/dist/cjs/resolvers/query/restricted/notes.d.ts +16 -0
- package/dist/cjs/resolvers/query/restricted/notes.js +44 -0
- package/dist/cjs/resolvers/query/restricted/quesBook.js +14 -0
- package/dist/cjs/resolvers/query/restricted/video.js +7 -0
- package/dist/mjs/models/Chapter.d.ts +0 -2
- package/dist/mjs/models/Concept.d.ts +2 -0
- package/dist/mjs/models/Note.d.ts +4 -4
- package/dist/mjs/resolvers/fragments/chapter.d.ts +0 -1
- package/dist/mjs/resolvers/fragments/chapter.js +0 -19
- package/dist/mjs/resolvers/fragments/concept.d.ts +1 -0
- package/dist/mjs/resolvers/fragments/concept.js +19 -0
- package/dist/mjs/resolvers/mutation/restricted/chapter.d.ts +1 -15
- package/dist/mjs/resolvers/mutation/restricted/chapter.js +1 -57
- package/dist/mjs/resolvers/mutation/restricted/index.d.ts +1 -0
- package/dist/mjs/resolvers/mutation/restricted/index.js +1 -0
- package/dist/mjs/resolvers/mutation/restricted/notes.d.ts +31 -0
- package/dist/mjs/resolvers/mutation/restricted/notes.js +107 -0
- package/dist/mjs/resolvers/mutation/restricted/osce.d.ts +1 -14
- package/dist/mjs/resolvers/mutation/restricted/osce.js +1 -49
- package/dist/mjs/resolvers/query/restricted/concepts.js +7 -0
- package/dist/mjs/resolvers/query/restricted/index.d.ts +1 -0
- package/dist/mjs/resolvers/query/restricted/index.js +1 -0
- package/dist/mjs/resolvers/query/restricted/notes.d.ts +16 -0
- package/dist/mjs/resolvers/query/restricted/notes.js +41 -0
- package/dist/mjs/resolvers/query/restricted/quesBook.js +14 -0
- package/dist/mjs/resolvers/query/restricted/video.js +7 -0
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IFile } from './File';
|
|
2
2
|
import { IHighlightNode } from './Highlight';
|
|
3
|
-
import { IUserChapterNote } from './Note';
|
|
4
3
|
import { IPicture } from './Picture';
|
|
5
4
|
import { ETopicType } from './Topic';
|
|
6
5
|
import { Id } from './Type';
|
|
@@ -13,6 +12,5 @@ export interface IChapter {
|
|
|
13
12
|
typeId: ETopicType | null;
|
|
14
13
|
pictures?: IPicture[];
|
|
15
14
|
files?: IFile[];
|
|
16
|
-
userNote: null | IUserChapterNote;
|
|
17
15
|
highlights?: IHighlightNode[];
|
|
18
16
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IChapter } from './Chapter';
|
|
2
|
+
import { IUserConceptNote } from './Note';
|
|
2
3
|
import { EPaceType } from './Paces';
|
|
3
4
|
import { IEntitlement } from './Product';
|
|
4
5
|
import { ITopic } from './Topic';
|
|
@@ -28,4 +29,5 @@ export interface IConcept {
|
|
|
28
29
|
redCards?: number | null;
|
|
29
30
|
dailyFeedCards?: number | null;
|
|
30
31
|
status?: EUserLearningStatus | null;
|
|
32
|
+
userNote: null | IUserConceptNote;
|
|
31
33
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IConcept } from './Concept';
|
|
2
2
|
import { IOsceStation } from './OsceStation';
|
|
3
3
|
import { Id } from './Type';
|
|
4
4
|
export interface IUserNote {
|
|
@@ -8,9 +8,9 @@ export interface IUserNote {
|
|
|
8
8
|
userId: Id;
|
|
9
9
|
note: string;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export interface IUserConceptNote extends IUserNote {
|
|
12
|
+
conceptId: Id;
|
|
13
|
+
concept: IConcept;
|
|
14
14
|
}
|
|
15
15
|
export interface IUserStationNote extends IUserNote {
|
|
16
16
|
stationId: Id;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CHAPTER_WITH_HIGHLIGHT_FIELDS = exports.
|
|
3
|
+
exports.CHAPTER_WITH_HIGHLIGHT_FIELDS = exports.CHAPTER_FIELDS = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const picture_1 = require("./picture");
|
|
6
6
|
const highlight_1 = require("./highlight");
|
|
@@ -17,13 +17,6 @@ exports.CHAPTER_FIELDS = (0, client_1.gql) `
|
|
|
17
17
|
highlights {
|
|
18
18
|
...HighlightFields
|
|
19
19
|
}
|
|
20
|
-
userNote {
|
|
21
|
-
id
|
|
22
|
-
userId
|
|
23
|
-
chapterId
|
|
24
|
-
note
|
|
25
|
-
updatedAt
|
|
26
|
-
}
|
|
27
20
|
files {
|
|
28
21
|
id
|
|
29
22
|
title
|
|
@@ -34,18 +27,6 @@ exports.CHAPTER_FIELDS = (0, client_1.gql) `
|
|
|
34
27
|
}
|
|
35
28
|
`;
|
|
36
29
|
// used in cache updator
|
|
37
|
-
exports.UPSERT_CHAPTER_NOTE_FRAGMENT = (0, client_1.gql) `
|
|
38
|
-
fragment UpsertChapterNoteFragment on Chapter {
|
|
39
|
-
userNote {
|
|
40
|
-
userId
|
|
41
|
-
chapterId
|
|
42
|
-
note
|
|
43
|
-
createdAt
|
|
44
|
-
updatedAt
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
// used in cache updator
|
|
49
30
|
exports.CHAPTER_WITH_HIGHLIGHT_FIELDS = (0, client_1.gql) `
|
|
50
31
|
fragment ChapterWithHighlightFields on Chapter {
|
|
51
32
|
highlights {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STATUS_CONCEPT_FRAGMENT = exports.CONCEPT_FIELDS = void 0;
|
|
3
|
+
exports.UPSERT_CONCEPT_NOTE_FRAGMENT = exports.STATUS_CONCEPT_FRAGMENT = exports.CONCEPT_FIELDS = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const chapter_1 = require("./chapter");
|
|
6
6
|
const video_1 = require("./video");
|
|
@@ -30,6 +30,13 @@ exports.CONCEPT_FIELDS = (0, client_1.gql) `
|
|
|
30
30
|
videos {
|
|
31
31
|
...VideoFields
|
|
32
32
|
}
|
|
33
|
+
userNote {
|
|
34
|
+
id
|
|
35
|
+
userId
|
|
36
|
+
conceptId
|
|
37
|
+
note
|
|
38
|
+
updatedAt
|
|
39
|
+
}
|
|
33
40
|
}
|
|
34
41
|
`;
|
|
35
42
|
// used in cache updator
|
|
@@ -38,3 +45,15 @@ exports.STATUS_CONCEPT_FRAGMENT = (0, client_1.gql) `
|
|
|
38
45
|
status
|
|
39
46
|
}
|
|
40
47
|
`;
|
|
48
|
+
// used in cache updator
|
|
49
|
+
exports.UPSERT_CONCEPT_NOTE_FRAGMENT = (0, client_1.gql) `
|
|
50
|
+
fragment UpsertConceptNoteFragment on Concept {
|
|
51
|
+
userNote {
|
|
52
|
+
userId
|
|
53
|
+
note
|
|
54
|
+
conceptId
|
|
55
|
+
createdAt
|
|
56
|
+
updatedAt
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { IChapterHighlight, IHighlightNode,
|
|
2
|
+
import { IChapterHighlight, IHighlightNode, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
|
-
/**
|
|
6
|
-
* upsertChapterNote
|
|
7
|
-
*/
|
|
8
|
-
export declare const UPSERT_CHAPTER_NOTE: import("@apollo/client").DocumentNode;
|
|
9
|
-
export interface IUpsertChapterNoteVar {
|
|
10
|
-
chapterId: number;
|
|
11
|
-
note: string;
|
|
12
|
-
marksheetId?: number;
|
|
13
|
-
}
|
|
14
|
-
export type IUpsertChapterNoteData = RestrictedData<graphqlNormalize & Omit<IUserChapterNote, 'chapter'>, 'upsertChapterNote'>;
|
|
15
|
-
export declare const updateCacheOnUpsertChapterNote: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertChapterNoteData>, options: ApolloUpdateOptions<IUpsertChapterNoteVar>) => void;
|
|
16
|
-
export declare const optimisticUpsertChapterNote: (data: IUpsertChapterNoteVar & {
|
|
17
|
-
userId: number;
|
|
18
|
-
}) => IUpsertChapterNoteData;
|
|
19
5
|
/**
|
|
20
6
|
* addChapterHighlight
|
|
21
7
|
*/
|
|
@@ -1,66 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getChapterHighlightOptimisticResponse = exports.updateChapterHighlights = exports.ADD_CHAPTER_HIGHLIGHT =
|
|
3
|
+
exports.getChapterHighlightOptimisticResponse = exports.updateChapterHighlights = exports.ADD_CHAPTER_HIGHLIGHT = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const fragments_1 = require("../../fragments");
|
|
6
|
-
/**
|
|
7
|
-
* upsertChapterNote
|
|
8
|
-
*/
|
|
9
|
-
exports.UPSERT_CHAPTER_NOTE = (0, client_1.gql) `
|
|
10
|
-
mutation UpsertChapterNote(
|
|
11
|
-
$chapterId: Int!
|
|
12
|
-
$note: String!
|
|
13
|
-
$marksheetId: Int
|
|
14
|
-
) {
|
|
15
|
-
restricted {
|
|
16
|
-
upsertChapterNote(
|
|
17
|
-
chapterId: $chapterId
|
|
18
|
-
note: $note
|
|
19
|
-
marksheetId: $marksheetId
|
|
20
|
-
) {
|
|
21
|
-
id
|
|
22
|
-
chapterId
|
|
23
|
-
userId
|
|
24
|
-
note
|
|
25
|
-
createdAt
|
|
26
|
-
updatedAt
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
const updateCacheOnUpsertChapterNote = (cache, result, options) => {
|
|
32
|
-
const { upsertChapterNote } = result?.data?.restricted || {};
|
|
33
|
-
const { variables } = options || {};
|
|
34
|
-
if (!variables || !upsertChapterNote) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
cache.writeFragment({
|
|
38
|
-
id: cache.identify({
|
|
39
|
-
id: variables.chapterId,
|
|
40
|
-
__typename: 'Chapter',
|
|
41
|
-
}),
|
|
42
|
-
data: {
|
|
43
|
-
userNote: upsertChapterNote,
|
|
44
|
-
},
|
|
45
|
-
fragment: fragments_1.UPSERT_CHAPTER_NOTE_FRAGMENT,
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
exports.updateCacheOnUpsertChapterNote = updateCacheOnUpsertChapterNote;
|
|
49
|
-
const optimisticUpsertChapterNote = (data) => {
|
|
50
|
-
const payload = {
|
|
51
|
-
restricted: {
|
|
52
|
-
upsertChapterNote: {
|
|
53
|
-
__typename: 'UserChapterNote',
|
|
54
|
-
...data,
|
|
55
|
-
id: Date.now(),
|
|
56
|
-
createdAt: new Date(),
|
|
57
|
-
updatedAt: new Date(),
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
return payload;
|
|
62
|
-
};
|
|
63
|
-
exports.optimisticUpsertChapterNote = optimisticUpsertChapterNote;
|
|
64
6
|
exports.ADD_CHAPTER_HIGHLIGHT = (0, client_1.gql) `
|
|
65
7
|
${fragments_1.HIGHLIGHT_FIELDS}
|
|
66
8
|
mutation AddChapterHighlight(
|
|
@@ -19,6 +19,7 @@ __exportStar(require("./chapter"), exports);
|
|
|
19
19
|
__exportStar(require("./contactUs"), exports);
|
|
20
20
|
__exportStar(require("./marksheet"), exports);
|
|
21
21
|
__exportStar(require("./mockTest"), exports);
|
|
22
|
+
__exportStar(require("./notes"), exports);
|
|
22
23
|
__exportStar(require("./notification"), exports);
|
|
23
24
|
__exportStar(require("./osce"), exports);
|
|
24
25
|
__exportStar(require("./preset"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ApolloCache } from "@apollo/client";
|
|
2
|
+
import { IUserConceptNote, IUserStationNote } from "../../../models";
|
|
3
|
+
import { ApolloUpdateResultRestricted, ApolloUpdateOptions } from "../../apollo";
|
|
4
|
+
import { RestrictedData, graphqlNormalize } from "../../types";
|
|
5
|
+
/**
|
|
6
|
+
* upsertConceptNote
|
|
7
|
+
*/
|
|
8
|
+
export declare const UPSERT_CONCEPT_NOTE: import("@apollo/client").DocumentNode;
|
|
9
|
+
export interface IUpsertConceptNoteVar {
|
|
10
|
+
conceptId: number;
|
|
11
|
+
note: string;
|
|
12
|
+
marksheetId?: number;
|
|
13
|
+
}
|
|
14
|
+
export type IUpsertConceptNoteData = RestrictedData<graphqlNormalize & Omit<IUserConceptNote, 'concept'>, 'upsertConceptNote'>;
|
|
15
|
+
export declare const updateCacheOnUpsertConceptNote: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertConceptNoteData>, options: ApolloUpdateOptions<IUpsertConceptNoteVar>) => void;
|
|
16
|
+
export declare const optimisticUpsertConceptNote: (data: IUpsertConceptNoteVar & {
|
|
17
|
+
userId: number;
|
|
18
|
+
}) => IUpsertConceptNoteData;
|
|
19
|
+
/**
|
|
20
|
+
* upsertStationNote
|
|
21
|
+
*/
|
|
22
|
+
export declare const UPSERT_STATION_NOTE: import("@apollo/client").DocumentNode;
|
|
23
|
+
export interface IUpsertStationNoteVar {
|
|
24
|
+
stationId: number;
|
|
25
|
+
note: string;
|
|
26
|
+
}
|
|
27
|
+
export type IUpsertStationNoteData = RestrictedData<graphqlNormalize & Omit<IUserStationNote, 'station'>, 'upsertStationNote'>;
|
|
28
|
+
export declare const updateCacheOnUpsertStationNote: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertStationNoteData>, options: ApolloUpdateOptions<IUpsertStationNoteVar>) => void;
|
|
29
|
+
export declare const optimisticUpsertStationNote: (data: IUpsertStationNoteVar & {
|
|
30
|
+
userId: number;
|
|
31
|
+
}) => IUpsertStationNoteData;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optimisticUpsertStationNote = exports.updateCacheOnUpsertStationNote = exports.UPSERT_STATION_NOTE = exports.optimisticUpsertConceptNote = exports.updateCacheOnUpsertConceptNote = exports.UPSERT_CONCEPT_NOTE = void 0;
|
|
4
|
+
const client_1 = require("@apollo/client");
|
|
5
|
+
const fragments_1 = require("../../fragments");
|
|
6
|
+
/**
|
|
7
|
+
* upsertConceptNote
|
|
8
|
+
*/
|
|
9
|
+
exports.UPSERT_CONCEPT_NOTE = (0, client_1.gql) `
|
|
10
|
+
mutation UpsertConceptNote(
|
|
11
|
+
$conceptId: Int!
|
|
12
|
+
$note: String!
|
|
13
|
+
$marksheetId: Int
|
|
14
|
+
) {
|
|
15
|
+
restricted {
|
|
16
|
+
upsertConceptNote(
|
|
17
|
+
conceptId: $conceptId
|
|
18
|
+
note: $note
|
|
19
|
+
marksheetId: $marksheetId
|
|
20
|
+
) {
|
|
21
|
+
id
|
|
22
|
+
conceptId
|
|
23
|
+
userId
|
|
24
|
+
note
|
|
25
|
+
createdAt
|
|
26
|
+
updatedAt
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
const updateCacheOnUpsertConceptNote = (cache, result, options) => {
|
|
32
|
+
const { upsertConceptNote } = result?.data?.restricted || {};
|
|
33
|
+
const { variables } = options || {};
|
|
34
|
+
if (!variables || !upsertConceptNote) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
cache.writeFragment({
|
|
38
|
+
id: cache.identify({
|
|
39
|
+
id: variables.conceptId,
|
|
40
|
+
__typename: 'Concept',
|
|
41
|
+
}),
|
|
42
|
+
data: {
|
|
43
|
+
userNote: upsertConceptNote,
|
|
44
|
+
},
|
|
45
|
+
fragment: fragments_1.UPSERT_CONCEPT_NOTE_FRAGMENT,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.updateCacheOnUpsertConceptNote = updateCacheOnUpsertConceptNote;
|
|
49
|
+
const optimisticUpsertConceptNote = (data) => {
|
|
50
|
+
const payload = {
|
|
51
|
+
restricted: {
|
|
52
|
+
upsertConceptNote: {
|
|
53
|
+
__typename: 'UserConceptNote',
|
|
54
|
+
...data,
|
|
55
|
+
id: Date.now(),
|
|
56
|
+
conceptId: Date.now(),
|
|
57
|
+
createdAt: new Date(),
|
|
58
|
+
updatedAt: new Date(),
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
return payload;
|
|
63
|
+
};
|
|
64
|
+
exports.optimisticUpsertConceptNote = optimisticUpsertConceptNote;
|
|
65
|
+
/**
|
|
66
|
+
* upsertStationNote
|
|
67
|
+
*/
|
|
68
|
+
exports.UPSERT_STATION_NOTE = (0, client_1.gql) `
|
|
69
|
+
mutation UpsertStationNote($stationId: Int!, $note: String!) {
|
|
70
|
+
restricted {
|
|
71
|
+
upsertStationNote(stationId: $stationId, note: $note) {
|
|
72
|
+
id
|
|
73
|
+
stationId
|
|
74
|
+
userId
|
|
75
|
+
note
|
|
76
|
+
createdAt
|
|
77
|
+
updatedAt
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
const updateCacheOnUpsertStationNote = (cache, result, options) => {
|
|
83
|
+
const { upsertStationNote } = result?.data?.restricted || {};
|
|
84
|
+
const { variables } = options || {};
|
|
85
|
+
if (!variables || !upsertStationNote) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
cache.writeFragment({
|
|
89
|
+
id: cache.identify({
|
|
90
|
+
id: variables.stationId,
|
|
91
|
+
__typename: 'OsceStation',
|
|
92
|
+
}),
|
|
93
|
+
data: {
|
|
94
|
+
userNote: upsertStationNote,
|
|
95
|
+
},
|
|
96
|
+
fragment: fragments_1.UPSERT_STATION_NOTE_FRAGMENT,
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
exports.updateCacheOnUpsertStationNote = updateCacheOnUpsertStationNote;
|
|
100
|
+
const optimisticUpsertStationNote = (data) => {
|
|
101
|
+
const payload = {
|
|
102
|
+
restricted: {
|
|
103
|
+
upsertStationNote: {
|
|
104
|
+
__typename: 'UserStationNote',
|
|
105
|
+
...data,
|
|
106
|
+
id: Date.now(),
|
|
107
|
+
createdAt: new Date(),
|
|
108
|
+
updatedAt: new Date(),
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
return payload;
|
|
113
|
+
};
|
|
114
|
+
exports.optimisticUpsertStationNote = optimisticUpsertStationNote;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { EEntitlementType, EOsceMarksheetAction, EOsceMarksheetState, EOsceRoles, EPaceMarkType, EProductType, EStudyAction, IOsceMarksheet, IOsceMarksheetMark,
|
|
2
|
+
import { EEntitlementType, EOsceMarksheetAction, EOsceMarksheetState, EOsceRoles, EPaceMarkType, EProductType, EStudyAction, IOsceMarksheet, IOsceMarksheetMark, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { IOsceMatchmakingAction } from '../../subscription/osce';
|
|
5
5
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
@@ -141,16 +141,3 @@ export interface ILeaveOsceMarksheetVar {
|
|
|
141
141
|
osceMarksheetId: Id;
|
|
142
142
|
}
|
|
143
143
|
export type ILeaveOsceMarksheetData = RestrictedData<graphqlNormalize & IOsceMarksheet, 'leaveOsceMarksheet'>;
|
|
144
|
-
/**
|
|
145
|
-
* upsertStationNote
|
|
146
|
-
*/
|
|
147
|
-
export declare const UPSERT_STATION_NOTE: import("@apollo/client").DocumentNode;
|
|
148
|
-
export interface IUpsertStationNoteVar {
|
|
149
|
-
stationId: number;
|
|
150
|
-
note: string;
|
|
151
|
-
}
|
|
152
|
-
export type IUpsertStationNoteData = RestrictedData<graphqlNormalize & Omit<IUserStationNote, 'station'>, 'upsertStationNote'>;
|
|
153
|
-
export declare const updateCacheOnUpsertStationNote: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertStationNoteData>, options: ApolloUpdateOptions<IUpsertStationNoteVar>) => void;
|
|
154
|
-
export declare const optimisticUpsertStationNote: (data: IUpsertStationNoteVar & {
|
|
155
|
-
userId: number;
|
|
156
|
-
}) => IUpsertStationNoteData;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const models_1 = require("../../../models");
|
|
6
6
|
const fragments_1 = require("../../fragments");
|
|
@@ -300,53 +300,3 @@ exports.LEAVE_OSCE_MARKSHEET = (0, client_1.gql) `
|
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
`;
|
|
303
|
-
/**
|
|
304
|
-
* upsertStationNote
|
|
305
|
-
*/
|
|
306
|
-
exports.UPSERT_STATION_NOTE = (0, client_1.gql) `
|
|
307
|
-
mutation UpsertStationNote($stationId: Int!, $note: String!) {
|
|
308
|
-
restricted {
|
|
309
|
-
upsertStationNote(stationId: $stationId, note: $note) {
|
|
310
|
-
id
|
|
311
|
-
stationId
|
|
312
|
-
userId
|
|
313
|
-
note
|
|
314
|
-
createdAt
|
|
315
|
-
updatedAt
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
`;
|
|
320
|
-
const updateCacheOnUpsertStationNote = (cache, result, options) => {
|
|
321
|
-
const { upsertStationNote } = result?.data?.restricted || {};
|
|
322
|
-
const { variables } = options || {};
|
|
323
|
-
if (!variables || !upsertStationNote) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
cache.writeFragment({
|
|
327
|
-
id: cache.identify({
|
|
328
|
-
id: variables.stationId,
|
|
329
|
-
__typename: 'OsceStation',
|
|
330
|
-
}),
|
|
331
|
-
data: {
|
|
332
|
-
userNote: upsertStationNote,
|
|
333
|
-
},
|
|
334
|
-
fragment: fragments_1.UPSERT_STATION_NOTE_FRAGMENT,
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
|
-
exports.updateCacheOnUpsertStationNote = updateCacheOnUpsertStationNote;
|
|
338
|
-
const optimisticUpsertStationNote = (data) => {
|
|
339
|
-
const payload = {
|
|
340
|
-
restricted: {
|
|
341
|
-
upsertStationNote: {
|
|
342
|
-
__typename: 'UserStationNote',
|
|
343
|
-
...data,
|
|
344
|
-
id: Date.now(),
|
|
345
|
-
createdAt: new Date(),
|
|
346
|
-
updatedAt: new Date(),
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
};
|
|
350
|
-
return payload;
|
|
351
|
-
};
|
|
352
|
-
exports.optimisticUpsertStationNote = optimisticUpsertStationNote;
|
|
@@ -19,6 +19,7 @@ __exportStar(require("./concepts"), exports);
|
|
|
19
19
|
__exportStar(require("./global"), exports);
|
|
20
20
|
__exportStar(require("./marksheet"), exports);
|
|
21
21
|
__exportStar(require("./mockTests"), exports);
|
|
22
|
+
__exportStar(require("./notes"), exports);
|
|
22
23
|
__exportStar(require("./notification"), exports);
|
|
23
24
|
__exportStar(require("./osce"), exports);
|
|
24
25
|
__exportStar(require("./preset"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IUserConceptNote, IUserStationNote } from '../../../models';
|
|
2
|
+
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
3
|
+
export interface IConceptNotesVar {
|
|
4
|
+
search: string | null;
|
|
5
|
+
limit: number;
|
|
6
|
+
offset: number;
|
|
7
|
+
}
|
|
8
|
+
export type IConceptNotesData = RestrictedData<graphqlNormalize & IUserConceptNote[], 'conceptNotes'>;
|
|
9
|
+
export declare const CONCEPT_NOTES: import("@apollo/client").DocumentNode;
|
|
10
|
+
export interface IStationNotesVar {
|
|
11
|
+
search: string | null;
|
|
12
|
+
limit: number;
|
|
13
|
+
offset: number;
|
|
14
|
+
}
|
|
15
|
+
export type IStationNotesData = RestrictedData<graphqlNormalize & IUserStationNote[], 'stationNotes'>;
|
|
16
|
+
export declare const STATION_NOTES: import("@apollo/client").DocumentNode;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.STATION_NOTES = exports.CONCEPT_NOTES = void 0;
|
|
4
|
+
const client_1 = require("@apollo/client");
|
|
5
|
+
exports.CONCEPT_NOTES = (0, client_1.gql) `
|
|
6
|
+
query ConceptNotes($search: String, $limit: Int, $offset: Int) {
|
|
7
|
+
restricted {
|
|
8
|
+
conceptNotes(search: $search, limit: $limit, offset: $offset) {
|
|
9
|
+
id
|
|
10
|
+
createdAt
|
|
11
|
+
updatedAt
|
|
12
|
+
note
|
|
13
|
+
userId
|
|
14
|
+
conceptId
|
|
15
|
+
concept {
|
|
16
|
+
name
|
|
17
|
+
topic {
|
|
18
|
+
id
|
|
19
|
+
name
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
exports.STATION_NOTES = (0, client_1.gql) `
|
|
27
|
+
query StationNotes($search: String, $limit: Int, $offset: Int) {
|
|
28
|
+
restricted {
|
|
29
|
+
stationNotes(search: $search, limit: $limit, offset: $offset) {
|
|
30
|
+
id
|
|
31
|
+
createdAt
|
|
32
|
+
updatedAt
|
|
33
|
+
note
|
|
34
|
+
userId
|
|
35
|
+
stationId
|
|
36
|
+
station {
|
|
37
|
+
id
|
|
38
|
+
name
|
|
39
|
+
hiddenName
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
@@ -36,6 +36,13 @@ exports.QBANK_KNOWLEDGE_VIDEO_LIBRARY = (0, client_1.gql) `
|
|
|
36
36
|
chapter {
|
|
37
37
|
...ChapterFields
|
|
38
38
|
}
|
|
39
|
+
userNote {
|
|
40
|
+
id
|
|
41
|
+
userId
|
|
42
|
+
conceptId
|
|
43
|
+
note
|
|
44
|
+
updatedAt
|
|
45
|
+
}
|
|
39
46
|
topicId
|
|
40
47
|
videos {
|
|
41
48
|
id
|
|
@@ -89,6 +96,13 @@ exports.PUBLIC_QBANK_KNOWLEDGE_LIBRARY = (0, client_1.gql) `
|
|
|
89
96
|
...ChapterFields
|
|
90
97
|
}
|
|
91
98
|
topicId
|
|
99
|
+
userNote {
|
|
100
|
+
id
|
|
101
|
+
userId
|
|
102
|
+
conceptId
|
|
103
|
+
note
|
|
104
|
+
updatedAt
|
|
105
|
+
}
|
|
92
106
|
videos {
|
|
93
107
|
id
|
|
94
108
|
demo
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IFile } from './File';
|
|
2
2
|
import { IHighlightNode } from './Highlight';
|
|
3
|
-
import { IUserChapterNote } from './Note';
|
|
4
3
|
import { IPicture } from './Picture';
|
|
5
4
|
import { ETopicType } from './Topic';
|
|
6
5
|
import { Id } from './Type';
|
|
@@ -13,6 +12,5 @@ export interface IChapter {
|
|
|
13
12
|
typeId: ETopicType | null;
|
|
14
13
|
pictures?: IPicture[];
|
|
15
14
|
files?: IFile[];
|
|
16
|
-
userNote: null | IUserChapterNote;
|
|
17
15
|
highlights?: IHighlightNode[];
|
|
18
16
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IChapter } from './Chapter';
|
|
2
|
+
import { IUserConceptNote } from './Note';
|
|
2
3
|
import { EPaceType } from './Paces';
|
|
3
4
|
import { IEntitlement } from './Product';
|
|
4
5
|
import { ITopic } from './Topic';
|
|
@@ -28,4 +29,5 @@ export interface IConcept {
|
|
|
28
29
|
redCards?: number | null;
|
|
29
30
|
dailyFeedCards?: number | null;
|
|
30
31
|
status?: EUserLearningStatus | null;
|
|
32
|
+
userNote: null | IUserConceptNote;
|
|
31
33
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IConcept } from './Concept';
|
|
2
2
|
import { IOsceStation } from './OsceStation';
|
|
3
3
|
import { Id } from './Type';
|
|
4
4
|
export interface IUserNote {
|
|
@@ -8,9 +8,9 @@ export interface IUserNote {
|
|
|
8
8
|
userId: Id;
|
|
9
9
|
note: string;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export interface IUserConceptNote extends IUserNote {
|
|
12
|
+
conceptId: Id;
|
|
13
|
+
concept: IConcept;
|
|
14
14
|
}
|
|
15
15
|
export interface IUserStationNote extends IUserNote {
|
|
16
16
|
stationId: Id;
|
|
@@ -14,13 +14,6 @@ export const CHAPTER_FIELDS = gql `
|
|
|
14
14
|
highlights {
|
|
15
15
|
...HighlightFields
|
|
16
16
|
}
|
|
17
|
-
userNote {
|
|
18
|
-
id
|
|
19
|
-
userId
|
|
20
|
-
chapterId
|
|
21
|
-
note
|
|
22
|
-
updatedAt
|
|
23
|
-
}
|
|
24
17
|
files {
|
|
25
18
|
id
|
|
26
19
|
title
|
|
@@ -31,18 +24,6 @@ export const CHAPTER_FIELDS = gql `
|
|
|
31
24
|
}
|
|
32
25
|
`;
|
|
33
26
|
// used in cache updator
|
|
34
|
-
export const UPSERT_CHAPTER_NOTE_FRAGMENT = gql `
|
|
35
|
-
fragment UpsertChapterNoteFragment on Chapter {
|
|
36
|
-
userNote {
|
|
37
|
-
userId
|
|
38
|
-
chapterId
|
|
39
|
-
note
|
|
40
|
-
createdAt
|
|
41
|
-
updatedAt
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
45
|
-
// used in cache updator
|
|
46
27
|
export const CHAPTER_WITH_HIGHLIGHT_FIELDS = gql `
|
|
47
28
|
fragment ChapterWithHighlightFields on Chapter {
|
|
48
29
|
highlights {
|
|
@@ -27,6 +27,13 @@ export const CONCEPT_FIELDS = gql `
|
|
|
27
27
|
videos {
|
|
28
28
|
...VideoFields
|
|
29
29
|
}
|
|
30
|
+
userNote {
|
|
31
|
+
id
|
|
32
|
+
userId
|
|
33
|
+
conceptId
|
|
34
|
+
note
|
|
35
|
+
updatedAt
|
|
36
|
+
}
|
|
30
37
|
}
|
|
31
38
|
`;
|
|
32
39
|
// used in cache updator
|
|
@@ -35,3 +42,15 @@ export const STATUS_CONCEPT_FRAGMENT = gql `
|
|
|
35
42
|
status
|
|
36
43
|
}
|
|
37
44
|
`;
|
|
45
|
+
// used in cache updator
|
|
46
|
+
export const UPSERT_CONCEPT_NOTE_FRAGMENT = gql `
|
|
47
|
+
fragment UpsertConceptNoteFragment on Concept {
|
|
48
|
+
userNote {
|
|
49
|
+
userId
|
|
50
|
+
note
|
|
51
|
+
conceptId
|
|
52
|
+
createdAt
|
|
53
|
+
updatedAt
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { IChapterHighlight, IHighlightNode,
|
|
2
|
+
import { IChapterHighlight, IHighlightNode, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
|
-
/**
|
|
6
|
-
* upsertChapterNote
|
|
7
|
-
*/
|
|
8
|
-
export declare const UPSERT_CHAPTER_NOTE: import("@apollo/client").DocumentNode;
|
|
9
|
-
export interface IUpsertChapterNoteVar {
|
|
10
|
-
chapterId: number;
|
|
11
|
-
note: string;
|
|
12
|
-
marksheetId?: number;
|
|
13
|
-
}
|
|
14
|
-
export type IUpsertChapterNoteData = RestrictedData<graphqlNormalize & Omit<IUserChapterNote, 'chapter'>, 'upsertChapterNote'>;
|
|
15
|
-
export declare const updateCacheOnUpsertChapterNote: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertChapterNoteData>, options: ApolloUpdateOptions<IUpsertChapterNoteVar>) => void;
|
|
16
|
-
export declare const optimisticUpsertChapterNote: (data: IUpsertChapterNoteVar & {
|
|
17
|
-
userId: number;
|
|
18
|
-
}) => IUpsertChapterNoteData;
|
|
19
5
|
/**
|
|
20
6
|
* addChapterHighlight
|
|
21
7
|
*/
|
|
@@ -1,61 +1,5 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
|
-
import { CHAPTER_WITH_HIGHLIGHT_FIELDS, HIGHLIGHT_FIELDS
|
|
3
|
-
/**
|
|
4
|
-
* upsertChapterNote
|
|
5
|
-
*/
|
|
6
|
-
export const UPSERT_CHAPTER_NOTE = gql `
|
|
7
|
-
mutation UpsertChapterNote(
|
|
8
|
-
$chapterId: Int!
|
|
9
|
-
$note: String!
|
|
10
|
-
$marksheetId: Int
|
|
11
|
-
) {
|
|
12
|
-
restricted {
|
|
13
|
-
upsertChapterNote(
|
|
14
|
-
chapterId: $chapterId
|
|
15
|
-
note: $note
|
|
16
|
-
marksheetId: $marksheetId
|
|
17
|
-
) {
|
|
18
|
-
id
|
|
19
|
-
chapterId
|
|
20
|
-
userId
|
|
21
|
-
note
|
|
22
|
-
createdAt
|
|
23
|
-
updatedAt
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
export const updateCacheOnUpsertChapterNote = (cache, result, options) => {
|
|
29
|
-
const { upsertChapterNote } = result?.data?.restricted || {};
|
|
30
|
-
const { variables } = options || {};
|
|
31
|
-
if (!variables || !upsertChapterNote) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
cache.writeFragment({
|
|
35
|
-
id: cache.identify({
|
|
36
|
-
id: variables.chapterId,
|
|
37
|
-
__typename: 'Chapter',
|
|
38
|
-
}),
|
|
39
|
-
data: {
|
|
40
|
-
userNote: upsertChapterNote,
|
|
41
|
-
},
|
|
42
|
-
fragment: UPSERT_CHAPTER_NOTE_FRAGMENT,
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
export const optimisticUpsertChapterNote = (data) => {
|
|
46
|
-
const payload = {
|
|
47
|
-
restricted: {
|
|
48
|
-
upsertChapterNote: {
|
|
49
|
-
__typename: 'UserChapterNote',
|
|
50
|
-
...data,
|
|
51
|
-
id: Date.now(),
|
|
52
|
-
createdAt: new Date(),
|
|
53
|
-
updatedAt: new Date(),
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
return payload;
|
|
58
|
-
};
|
|
2
|
+
import { CHAPTER_WITH_HIGHLIGHT_FIELDS, HIGHLIGHT_FIELDS } from '../../fragments';
|
|
59
3
|
export const ADD_CHAPTER_HIGHLIGHT = gql `
|
|
60
4
|
${HIGHLIGHT_FIELDS}
|
|
61
5
|
mutation AddChapterHighlight(
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ApolloCache } from "@apollo/client";
|
|
2
|
+
import { IUserConceptNote, IUserStationNote } from "../../../models";
|
|
3
|
+
import { ApolloUpdateResultRestricted, ApolloUpdateOptions } from "../../apollo";
|
|
4
|
+
import { RestrictedData, graphqlNormalize } from "../../types";
|
|
5
|
+
/**
|
|
6
|
+
* upsertConceptNote
|
|
7
|
+
*/
|
|
8
|
+
export declare const UPSERT_CONCEPT_NOTE: import("@apollo/client").DocumentNode;
|
|
9
|
+
export interface IUpsertConceptNoteVar {
|
|
10
|
+
conceptId: number;
|
|
11
|
+
note: string;
|
|
12
|
+
marksheetId?: number;
|
|
13
|
+
}
|
|
14
|
+
export type IUpsertConceptNoteData = RestrictedData<graphqlNormalize & Omit<IUserConceptNote, 'concept'>, 'upsertConceptNote'>;
|
|
15
|
+
export declare const updateCacheOnUpsertConceptNote: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertConceptNoteData>, options: ApolloUpdateOptions<IUpsertConceptNoteVar>) => void;
|
|
16
|
+
export declare const optimisticUpsertConceptNote: (data: IUpsertConceptNoteVar & {
|
|
17
|
+
userId: number;
|
|
18
|
+
}) => IUpsertConceptNoteData;
|
|
19
|
+
/**
|
|
20
|
+
* upsertStationNote
|
|
21
|
+
*/
|
|
22
|
+
export declare const UPSERT_STATION_NOTE: import("@apollo/client").DocumentNode;
|
|
23
|
+
export interface IUpsertStationNoteVar {
|
|
24
|
+
stationId: number;
|
|
25
|
+
note: string;
|
|
26
|
+
}
|
|
27
|
+
export type IUpsertStationNoteData = RestrictedData<graphqlNormalize & Omit<IUserStationNote, 'station'>, 'upsertStationNote'>;
|
|
28
|
+
export declare const updateCacheOnUpsertStationNote: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertStationNoteData>, options: ApolloUpdateOptions<IUpsertStationNoteVar>) => void;
|
|
29
|
+
export declare const optimisticUpsertStationNote: (data: IUpsertStationNoteVar & {
|
|
30
|
+
userId: number;
|
|
31
|
+
}) => IUpsertStationNoteData;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { gql } from "@apollo/client";
|
|
2
|
+
import { UPSERT_CONCEPT_NOTE_FRAGMENT, UPSERT_STATION_NOTE_FRAGMENT } from "../../fragments";
|
|
3
|
+
/**
|
|
4
|
+
* upsertConceptNote
|
|
5
|
+
*/
|
|
6
|
+
export const UPSERT_CONCEPT_NOTE = gql `
|
|
7
|
+
mutation UpsertConceptNote(
|
|
8
|
+
$conceptId: Int!
|
|
9
|
+
$note: String!
|
|
10
|
+
$marksheetId: Int
|
|
11
|
+
) {
|
|
12
|
+
restricted {
|
|
13
|
+
upsertConceptNote(
|
|
14
|
+
conceptId: $conceptId
|
|
15
|
+
note: $note
|
|
16
|
+
marksheetId: $marksheetId
|
|
17
|
+
) {
|
|
18
|
+
id
|
|
19
|
+
conceptId
|
|
20
|
+
userId
|
|
21
|
+
note
|
|
22
|
+
createdAt
|
|
23
|
+
updatedAt
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
export const updateCacheOnUpsertConceptNote = (cache, result, options) => {
|
|
29
|
+
const { upsertConceptNote } = result?.data?.restricted || {};
|
|
30
|
+
const { variables } = options || {};
|
|
31
|
+
if (!variables || !upsertConceptNote) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
cache.writeFragment({
|
|
35
|
+
id: cache.identify({
|
|
36
|
+
id: variables.conceptId,
|
|
37
|
+
__typename: 'Concept',
|
|
38
|
+
}),
|
|
39
|
+
data: {
|
|
40
|
+
userNote: upsertConceptNote,
|
|
41
|
+
},
|
|
42
|
+
fragment: UPSERT_CONCEPT_NOTE_FRAGMENT,
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export const optimisticUpsertConceptNote = (data) => {
|
|
46
|
+
const payload = {
|
|
47
|
+
restricted: {
|
|
48
|
+
upsertConceptNote: {
|
|
49
|
+
__typename: 'UserConceptNote',
|
|
50
|
+
...data,
|
|
51
|
+
id: Date.now(),
|
|
52
|
+
conceptId: Date.now(),
|
|
53
|
+
createdAt: new Date(),
|
|
54
|
+
updatedAt: new Date(),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
return payload;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* upsertStationNote
|
|
62
|
+
*/
|
|
63
|
+
export const UPSERT_STATION_NOTE = gql `
|
|
64
|
+
mutation UpsertStationNote($stationId: Int!, $note: String!) {
|
|
65
|
+
restricted {
|
|
66
|
+
upsertStationNote(stationId: $stationId, note: $note) {
|
|
67
|
+
id
|
|
68
|
+
stationId
|
|
69
|
+
userId
|
|
70
|
+
note
|
|
71
|
+
createdAt
|
|
72
|
+
updatedAt
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
export const updateCacheOnUpsertStationNote = (cache, result, options) => {
|
|
78
|
+
const { upsertStationNote } = result?.data?.restricted || {};
|
|
79
|
+
const { variables } = options || {};
|
|
80
|
+
if (!variables || !upsertStationNote) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
cache.writeFragment({
|
|
84
|
+
id: cache.identify({
|
|
85
|
+
id: variables.stationId,
|
|
86
|
+
__typename: 'OsceStation',
|
|
87
|
+
}),
|
|
88
|
+
data: {
|
|
89
|
+
userNote: upsertStationNote,
|
|
90
|
+
},
|
|
91
|
+
fragment: UPSERT_STATION_NOTE_FRAGMENT,
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
export const optimisticUpsertStationNote = (data) => {
|
|
95
|
+
const payload = {
|
|
96
|
+
restricted: {
|
|
97
|
+
upsertStationNote: {
|
|
98
|
+
__typename: 'UserStationNote',
|
|
99
|
+
...data,
|
|
100
|
+
id: Date.now(),
|
|
101
|
+
createdAt: new Date(),
|
|
102
|
+
updatedAt: new Date(),
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
return payload;
|
|
107
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { EEntitlementType, EOsceMarksheetAction, EOsceMarksheetState, EOsceRoles, EPaceMarkType, EProductType, EStudyAction, IOsceMarksheet, IOsceMarksheetMark,
|
|
2
|
+
import { EEntitlementType, EOsceMarksheetAction, EOsceMarksheetState, EOsceRoles, EPaceMarkType, EProductType, EStudyAction, IOsceMarksheet, IOsceMarksheetMark, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { IOsceMatchmakingAction } from '../../subscription/osce';
|
|
5
5
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
@@ -141,16 +141,3 @@ export interface ILeaveOsceMarksheetVar {
|
|
|
141
141
|
osceMarksheetId: Id;
|
|
142
142
|
}
|
|
143
143
|
export type ILeaveOsceMarksheetData = RestrictedData<graphqlNormalize & IOsceMarksheet, 'leaveOsceMarksheet'>;
|
|
144
|
-
/**
|
|
145
|
-
* upsertStationNote
|
|
146
|
-
*/
|
|
147
|
-
export declare const UPSERT_STATION_NOTE: import("@apollo/client").DocumentNode;
|
|
148
|
-
export interface IUpsertStationNoteVar {
|
|
149
|
-
stationId: number;
|
|
150
|
-
note: string;
|
|
151
|
-
}
|
|
152
|
-
export type IUpsertStationNoteData = RestrictedData<graphqlNormalize & Omit<IUserStationNote, 'station'>, 'upsertStationNote'>;
|
|
153
|
-
export declare const updateCacheOnUpsertStationNote: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertStationNoteData>, options: ApolloUpdateOptions<IUpsertStationNoteVar>) => void;
|
|
154
|
-
export declare const optimisticUpsertStationNote: (data: IUpsertStationNoteVar & {
|
|
155
|
-
userId: number;
|
|
156
|
-
}) => IUpsertStationNoteData;
|
|
@@ -1,6 +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, OSCE_STATION_FIELDS,
|
|
3
|
+
import { COMPLETED_OSCE_MARKSHEET_FRAGMENT, COMPLETED_OSCE_STATION_FRAGMENT, OSCE_MARKSHEET_FIELDS, OSCE_MATCHMAKING_ACTION_FIELDS, OSCE_STATION_FIELDS, } from '../../fragments';
|
|
4
4
|
export const START_OSCE_MATCHMAKING = gql `
|
|
5
5
|
mutation StartOsceMatchmaking($sessionId: String!) {
|
|
6
6
|
restricted {
|
|
@@ -294,51 +294,3 @@ export const LEAVE_OSCE_MARKSHEET = gql `
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
`;
|
|
297
|
-
/**
|
|
298
|
-
* upsertStationNote
|
|
299
|
-
*/
|
|
300
|
-
export const UPSERT_STATION_NOTE = gql `
|
|
301
|
-
mutation UpsertStationNote($stationId: Int!, $note: String!) {
|
|
302
|
-
restricted {
|
|
303
|
-
upsertStationNote(stationId: $stationId, note: $note) {
|
|
304
|
-
id
|
|
305
|
-
stationId
|
|
306
|
-
userId
|
|
307
|
-
note
|
|
308
|
-
createdAt
|
|
309
|
-
updatedAt
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
`;
|
|
314
|
-
export const updateCacheOnUpsertStationNote = (cache, result, options) => {
|
|
315
|
-
const { upsertStationNote } = result?.data?.restricted || {};
|
|
316
|
-
const { variables } = options || {};
|
|
317
|
-
if (!variables || !upsertStationNote) {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
cache.writeFragment({
|
|
321
|
-
id: cache.identify({
|
|
322
|
-
id: variables.stationId,
|
|
323
|
-
__typename: 'OsceStation',
|
|
324
|
-
}),
|
|
325
|
-
data: {
|
|
326
|
-
userNote: upsertStationNote,
|
|
327
|
-
},
|
|
328
|
-
fragment: UPSERT_STATION_NOTE_FRAGMENT,
|
|
329
|
-
});
|
|
330
|
-
};
|
|
331
|
-
export const optimisticUpsertStationNote = (data) => {
|
|
332
|
-
const payload = {
|
|
333
|
-
restricted: {
|
|
334
|
-
upsertStationNote: {
|
|
335
|
-
__typename: 'UserStationNote',
|
|
336
|
-
...data,
|
|
337
|
-
id: Date.now(),
|
|
338
|
-
createdAt: new Date(),
|
|
339
|
-
updatedAt: new Date(),
|
|
340
|
-
},
|
|
341
|
-
},
|
|
342
|
-
};
|
|
343
|
-
return payload;
|
|
344
|
-
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IUserConceptNote, IUserStationNote } from '../../../models';
|
|
2
|
+
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
3
|
+
export interface IConceptNotesVar {
|
|
4
|
+
search: string | null;
|
|
5
|
+
limit: number;
|
|
6
|
+
offset: number;
|
|
7
|
+
}
|
|
8
|
+
export type IConceptNotesData = RestrictedData<graphqlNormalize & IUserConceptNote[], 'conceptNotes'>;
|
|
9
|
+
export declare const CONCEPT_NOTES: import("@apollo/client").DocumentNode;
|
|
10
|
+
export interface IStationNotesVar {
|
|
11
|
+
search: string | null;
|
|
12
|
+
limit: number;
|
|
13
|
+
offset: number;
|
|
14
|
+
}
|
|
15
|
+
export type IStationNotesData = RestrictedData<graphqlNormalize & IUserStationNote[], 'stationNotes'>;
|
|
16
|
+
export declare const STATION_NOTES: import("@apollo/client").DocumentNode;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
export const CONCEPT_NOTES = gql `
|
|
3
|
+
query ConceptNotes($search: String, $limit: Int, $offset: Int) {
|
|
4
|
+
restricted {
|
|
5
|
+
conceptNotes(search: $search, limit: $limit, offset: $offset) {
|
|
6
|
+
id
|
|
7
|
+
createdAt
|
|
8
|
+
updatedAt
|
|
9
|
+
note
|
|
10
|
+
userId
|
|
11
|
+
conceptId
|
|
12
|
+
concept {
|
|
13
|
+
name
|
|
14
|
+
topic {
|
|
15
|
+
id
|
|
16
|
+
name
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
export const STATION_NOTES = gql `
|
|
24
|
+
query StationNotes($search: String, $limit: Int, $offset: Int) {
|
|
25
|
+
restricted {
|
|
26
|
+
stationNotes(search: $search, limit: $limit, offset: $offset) {
|
|
27
|
+
id
|
|
28
|
+
createdAt
|
|
29
|
+
updatedAt
|
|
30
|
+
note
|
|
31
|
+
userId
|
|
32
|
+
stationId
|
|
33
|
+
station {
|
|
34
|
+
id
|
|
35
|
+
name
|
|
36
|
+
hiddenName
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
@@ -33,6 +33,13 @@ export const QBANK_KNOWLEDGE_VIDEO_LIBRARY = gql `
|
|
|
33
33
|
chapter {
|
|
34
34
|
...ChapterFields
|
|
35
35
|
}
|
|
36
|
+
userNote {
|
|
37
|
+
id
|
|
38
|
+
userId
|
|
39
|
+
conceptId
|
|
40
|
+
note
|
|
41
|
+
updatedAt
|
|
42
|
+
}
|
|
36
43
|
topicId
|
|
37
44
|
videos {
|
|
38
45
|
id
|
|
@@ -86,6 +93,13 @@ export const PUBLIC_QBANK_KNOWLEDGE_LIBRARY = gql `
|
|
|
86
93
|
...ChapterFields
|
|
87
94
|
}
|
|
88
95
|
topicId
|
|
96
|
+
userNote {
|
|
97
|
+
id
|
|
98
|
+
userId
|
|
99
|
+
conceptId
|
|
100
|
+
note
|
|
101
|
+
updatedAt
|
|
102
|
+
}
|
|
89
103
|
videos {
|
|
90
104
|
id
|
|
91
105
|
demo
|