@quesmed/types-rn 2.6.47 → 2.6.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/models/Chapter.d.ts +2 -0
- package/models/Question.d.ts +2 -1
- package/models/Question.js +5 -1
- package/models/User.d.ts +10 -0
- package/package.json +1 -1
- package/resolvers/mutation/restricted/chapter.d.ts +8 -0
- package/resolvers/mutation/restricted/chapter.js +18 -0
- package/resolvers/mutation/restricted/index.d.ts +1 -0
- package/resolvers/mutation/restricted/index.js +1 -0
- package/resolvers/mutation/restricted/questionDiscussion.js +1 -0
- package/utils/commonFunctions.js +4 -1
package/models/Chapter.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { IFile } from './File';
|
|
|
2
2
|
import { IPicture } from './Picture';
|
|
3
3
|
import { ETopicType } from './Topic';
|
|
4
4
|
import { Id } from './Type';
|
|
5
|
+
import { IUserChapterNote } from './User';
|
|
5
6
|
export interface IChapter {
|
|
6
7
|
id: Id;
|
|
7
8
|
createdAt: number | Date;
|
|
@@ -11,4 +12,5 @@ export interface IChapter {
|
|
|
11
12
|
typeId: ETopicType | null;
|
|
12
13
|
pictures?: IPicture[];
|
|
13
14
|
files?: IFile[];
|
|
15
|
+
userNote: null | IUserChapterNote;
|
|
14
16
|
}
|
package/models/Question.d.ts
CHANGED
|
@@ -24,7 +24,8 @@ export declare enum EQuestionType {
|
|
|
24
24
|
PRESCRIPTION_ANSWER = 4,
|
|
25
25
|
EXTENDED_MATCHING_ANSWER = 5,
|
|
26
26
|
SELECT_THREE_ANSWER = 6,
|
|
27
|
-
RANKING_ANSWER = 7
|
|
27
|
+
RANKING_ANSWER = 7,
|
|
28
|
+
SBA_WITH_MULTIPLE_CHOICES = 8
|
|
28
29
|
}
|
|
29
30
|
export declare enum EQuestionLike {
|
|
30
31
|
NONE = 0,
|
package/models/Question.js
CHANGED
|
@@ -21,6 +21,7 @@ var EQuestionType;
|
|
|
21
21
|
EQuestionType[EQuestionType["EXTENDED_MATCHING_ANSWER"] = 5] = "EXTENDED_MATCHING_ANSWER";
|
|
22
22
|
EQuestionType[EQuestionType["SELECT_THREE_ANSWER"] = 6] = "SELECT_THREE_ANSWER";
|
|
23
23
|
EQuestionType[EQuestionType["RANKING_ANSWER"] = 7] = "RANKING_ANSWER";
|
|
24
|
+
EQuestionType[EQuestionType["SBA_WITH_MULTIPLE_CHOICES"] = 8] = "SBA_WITH_MULTIPLE_CHOICES";
|
|
24
25
|
})(EQuestionType = exports.EQuestionType || (exports.EQuestionType = {}));
|
|
25
26
|
var EQuestionLike;
|
|
26
27
|
(function (EQuestionLike) {
|
|
@@ -29,7 +30,10 @@ var EQuestionLike;
|
|
|
29
30
|
EQuestionLike[EQuestionLike["DISLIKE"] = 2] = "DISLIKE";
|
|
30
31
|
})(EQuestionLike = exports.EQuestionLike || (exports.EQuestionLike = {}));
|
|
31
32
|
function isQuestionSBA(data) {
|
|
32
|
-
return
|
|
33
|
+
return [
|
|
34
|
+
EQuestionType.SINGLE_BEST_ANSWER,
|
|
35
|
+
EQuestionType.SBA_WITH_MULTIPLE_CHOICES,
|
|
36
|
+
].includes(data.typeId);
|
|
33
37
|
}
|
|
34
38
|
exports.isQuestionSBA = isQuestionSBA;
|
|
35
39
|
function isQuestionQA(data) {
|
package/models/User.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ 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';
|
|
14
15
|
export type IUserSubsriptionDates = keyof ExtractKeysWithPattern<IPayload, 'EndDate'>;
|
|
15
16
|
export declare enum IAccessLevel {
|
|
16
17
|
SUBSCRIBER = "subscriber",
|
|
@@ -156,6 +157,15 @@ export interface IUserCompletedQuestion {
|
|
|
156
157
|
question: IQuestion;
|
|
157
158
|
concept: IConcept;
|
|
158
159
|
}
|
|
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
|
+
}
|
|
159
169
|
export interface IUserCompletedCard {
|
|
160
170
|
id: Id;
|
|
161
171
|
createdAt: number | Date;
|
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IUserChapterNote } from '../../../models';
|
|
2
|
+
import { RestrictedData } from '../../types';
|
|
3
|
+
export declare const UPSERT_CHAPTER_NOTE: import("@apollo/client").DocumentNode;
|
|
4
|
+
export interface IUpsertChapterNoteVar {
|
|
5
|
+
chapterId: number;
|
|
6
|
+
note: string;
|
|
7
|
+
}
|
|
8
|
+
export type IUpsertChapterNoteData = RestrictedData<IUserChapterNote, 'upsertChapterNote'>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UPSERT_CHAPTER_NOTE = void 0;
|
|
4
|
+
const client_1 = require("@apollo/client");
|
|
5
|
+
exports.UPSERT_CHAPTER_NOTE = (0, client_1.gql) `
|
|
6
|
+
mutation UpsertChapterNote($chapterId: Int!, $note: String!) {
|
|
7
|
+
restricted {
|
|
8
|
+
upsertChapterNote(chapterId: $chapterId, note: $note) {
|
|
9
|
+
id
|
|
10
|
+
chapterId
|
|
11
|
+
userId
|
|
12
|
+
note
|
|
13
|
+
createdAt
|
|
14
|
+
updatedAt
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./agora"), exports);
|
|
18
|
+
__exportStar(require("./chapter"), exports);
|
|
18
19
|
__exportStar(require("./contactUs"), exports);
|
|
19
20
|
__exportStar(require("./marksheet"), exports);
|
|
20
21
|
__exportStar(require("./mockTest"), exports);
|
|
@@ -33,6 +33,7 @@ exports.getLikeData = getLikeData;
|
|
|
33
33
|
const getQuestionTypeName = (typeId) => {
|
|
34
34
|
const mappedObj = {
|
|
35
35
|
[models_1.EQuestionType.SINGLE_BEST_ANSWER]: 'QuestionSBA',
|
|
36
|
+
[models_1.EQuestionType.SBA_WITH_MULTIPLE_CHOICES]: 'QuestionSBA',
|
|
36
37
|
[models_1.EQuestionType.QUESTION_ANSWER]: 'QuestionQA',
|
|
37
38
|
[models_1.EQuestionType.MULTIPLE_ANSWERS]: 'QuestionMultiA',
|
|
38
39
|
[models_1.EQuestionType.PRESCRIPTION_ANSWER]: 'QuestionPrescription',
|
package/utils/commonFunctions.js
CHANGED
|
@@ -51,7 +51,10 @@ function correctMark(mark) {
|
|
|
51
51
|
const flatAnswer = answer[0];
|
|
52
52
|
const jsonAnswer = typeof mark.mark === 'string' ? JSON.parse(mark.mark) : mark.mark;
|
|
53
53
|
const flatAttempt = jsonAnswer[0];
|
|
54
|
-
if (
|
|
54
|
+
if ([
|
|
55
|
+
models_1.EQuestionType.SINGLE_BEST_ANSWER,
|
|
56
|
+
models_1.EQuestionType.SBA_WITH_MULTIPLE_CHOICES,
|
|
57
|
+
].includes(mark.question.typeId)) {
|
|
55
58
|
const answer = flatAnswer;
|
|
56
59
|
const attempt = flatAttempt;
|
|
57
60
|
if (answer === attempt) {
|