@quesmed/types 2.6.80 → 2.6.82
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/User.d.ts +25 -3
- package/dist/cjs/models/User.js +6 -1
- package/dist/cjs/resolvers/fragments/user.d.ts +3 -1
- package/dist/cjs/resolvers/fragments/user.js +85 -53
- package/dist/cjs/resolvers/mutation/restricted/users.d.ts +7 -4
- package/dist/cjs/resolvers/mutation/restricted/users.js +30 -4
- package/dist/cjs/resolvers/query/restricted/osce.js +8 -1
- package/dist/cjs/resolvers/query/restricted/qBank.js +16 -2
- package/dist/cjs/resolvers/query/restricted/quesBook.js +7 -0
- package/dist/mjs/models/User.d.ts +25 -3
- package/dist/mjs/models/User.js +5 -0
- package/dist/mjs/resolvers/fragments/user.d.ts +3 -1
- package/dist/mjs/resolvers/fragments/user.js +84 -52
- package/dist/mjs/resolvers/mutation/restricted/users.d.ts +7 -4
- package/dist/mjs/resolvers/mutation/restricted/users.js +28 -3
- package/dist/mjs/resolvers/query/restricted/osce.js +8 -1
- package/dist/mjs/resolvers/query/restricted/qBank.js +16 -2
- package/dist/mjs/resolvers/query/restricted/quesBook.js +7 -0
- package/package.json +1 -1
|
@@ -19,6 +19,10 @@ export declare enum IAccessLevel {
|
|
|
19
19
|
DEMO = "demo",
|
|
20
20
|
EXPIRED = "expired"
|
|
21
21
|
}
|
|
22
|
+
export declare enum ETheme {
|
|
23
|
+
LIGHT = 0,
|
|
24
|
+
DARK = 1
|
|
25
|
+
}
|
|
22
26
|
export type IClassYear = 'Year 1' | 'Year 2' | 'Year 3' | 'Year 4' | 'Year 5' | 'Graduated' | 'PhD' | 'BSc' | 'MSc' | 'Beta Tester';
|
|
23
27
|
export declare const classYears: IClassYear[];
|
|
24
28
|
export declare const subscriptionDates: IUserSubsriptionDates[];
|
|
@@ -92,6 +96,26 @@ export interface IUserProgressData {
|
|
|
92
96
|
daysInPreviousStreak: number;
|
|
93
97
|
daysInLongestStreak: number;
|
|
94
98
|
}
|
|
99
|
+
export interface IUserSettings {
|
|
100
|
+
id: Id;
|
|
101
|
+
userId: Id;
|
|
102
|
+
updatedAt: number | Date;
|
|
103
|
+
globalSettings: {
|
|
104
|
+
dailyFeedResetTime: number;
|
|
105
|
+
dailyFeedMax: number;
|
|
106
|
+
theme: ETheme;
|
|
107
|
+
disabledColors: boolean;
|
|
108
|
+
expandedReading: boolean;
|
|
109
|
+
readingTextScale: number;
|
|
110
|
+
addToDailyFlashcards: boolean;
|
|
111
|
+
};
|
|
112
|
+
productSettings: {
|
|
113
|
+
examDate: number | Date | null;
|
|
114
|
+
nextFeedbackDate: number | Date;
|
|
115
|
+
feedback: string | null;
|
|
116
|
+
rating: number | null;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
95
119
|
export interface IUser {
|
|
96
120
|
id: Id;
|
|
97
121
|
createdAt: number | Date;
|
|
@@ -101,8 +125,6 @@ export interface IUser {
|
|
|
101
125
|
firstName: string;
|
|
102
126
|
lastName: string;
|
|
103
127
|
tocAccepted: boolean;
|
|
104
|
-
dailyFeedResetTime: number;
|
|
105
|
-
dailyFeedMax: number;
|
|
106
128
|
stripeCustomerId: string;
|
|
107
129
|
stripeLastSyncAt: number | Date | null;
|
|
108
130
|
referralCount: number;
|
|
@@ -110,7 +132,6 @@ export interface IUser {
|
|
|
110
132
|
graduationYear: number;
|
|
111
133
|
universityId: Id;
|
|
112
134
|
university: IUniversity;
|
|
113
|
-
examDate: number | Date | null;
|
|
114
135
|
accessLevel: IAccessLevel;
|
|
115
136
|
elo: number;
|
|
116
137
|
marksheets: IMarksheet[];
|
|
@@ -145,6 +166,7 @@ export interface IUser {
|
|
|
145
166
|
radiologyInterviewSubscriptionEndDate: number | Date | null;
|
|
146
167
|
plab1SubscriptionEndDate: number | Date | null;
|
|
147
168
|
plab2SubscriptionEndDate: number | Date | null;
|
|
169
|
+
settings: IUserSettings;
|
|
148
170
|
}
|
|
149
171
|
export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear, compareUnix?: number): IClassYear;
|
|
150
172
|
export declare function currentClassGroup(createdAtUnix: number, classYear: IClassYear): EClassYearGroup;
|
package/dist/cjs/models/User.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.currentClassGroup = exports.currentClassYear = exports.EPracticeIntensity = exports.classYearGroup = exports.EUserLearningPoint = exports.EUserLearningStatus = exports.EClassYearGroup = exports.dateProductMapping = exports.subscriptionDates = exports.classYears = exports.IAccessLevel = void 0;
|
|
3
|
+
exports.currentClassGroup = exports.currentClassYear = exports.EPracticeIntensity = exports.classYearGroup = exports.EUserLearningPoint = exports.EUserLearningStatus = exports.EClassYearGroup = exports.dateProductMapping = exports.subscriptionDates = exports.classYears = exports.ETheme = exports.IAccessLevel = void 0;
|
|
4
4
|
const luxon_1 = require("luxon");
|
|
5
5
|
const Product_1 = require("./Product");
|
|
6
6
|
var IAccessLevel;
|
|
@@ -11,6 +11,11 @@ var IAccessLevel;
|
|
|
11
11
|
IAccessLevel["DEMO"] = "demo";
|
|
12
12
|
IAccessLevel["EXPIRED"] = "expired";
|
|
13
13
|
})(IAccessLevel = exports.IAccessLevel || (exports.IAccessLevel = {}));
|
|
14
|
+
var ETheme;
|
|
15
|
+
(function (ETheme) {
|
|
16
|
+
ETheme[ETheme["LIGHT"] = 0] = "LIGHT";
|
|
17
|
+
ETheme[ETheme["DARK"] = 1] = "DARK";
|
|
18
|
+
})(ETheme = exports.ETheme || (exports.ETheme = {}));
|
|
14
19
|
exports.classYears = [
|
|
15
20
|
'Year 1',
|
|
16
21
|
'Year 2',
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export declare const USER_FIELDS: import("@apollo/client").DocumentNode;
|
|
2
1
|
export declare const COMPLETED_CARDS: import("@apollo/client").DocumentNode;
|
|
2
|
+
export declare const USER_SETTINGS_FIELDS: import("@apollo/client").DocumentNode;
|
|
3
|
+
export declare const USER_FIELDS: import("@apollo/client").DocumentNode;
|
|
4
|
+
export declare const UPDATE_USER_SETTINGS_FRAGMENT: import("@apollo/client").DocumentNode;
|
|
@@ -1,8 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.UPDATE_USER_SETTINGS_FRAGMENT = exports.USER_FIELDS = exports.USER_SETTINGS_FIELDS = exports.COMPLETED_CARDS = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
|
+
exports.COMPLETED_CARDS = (0, client_1.gql) `
|
|
6
|
+
fragment UserCompletedCards on User {
|
|
7
|
+
completedCards {
|
|
8
|
+
id
|
|
9
|
+
createdAt
|
|
10
|
+
updatedAt
|
|
11
|
+
concept {
|
|
12
|
+
id
|
|
13
|
+
name
|
|
14
|
+
}
|
|
15
|
+
lastSeen
|
|
16
|
+
reviewDate
|
|
17
|
+
score
|
|
18
|
+
iteration
|
|
19
|
+
optimalFactor
|
|
20
|
+
cardId
|
|
21
|
+
card {
|
|
22
|
+
id
|
|
23
|
+
conceptId
|
|
24
|
+
concept {
|
|
25
|
+
id
|
|
26
|
+
name
|
|
27
|
+
}
|
|
28
|
+
topic {
|
|
29
|
+
id
|
|
30
|
+
name
|
|
31
|
+
}
|
|
32
|
+
question
|
|
33
|
+
explanation
|
|
34
|
+
pictures {
|
|
35
|
+
id
|
|
36
|
+
createdAt
|
|
37
|
+
updatedAt
|
|
38
|
+
name
|
|
39
|
+
caption
|
|
40
|
+
index
|
|
41
|
+
path
|
|
42
|
+
path512
|
|
43
|
+
path256
|
|
44
|
+
thumbhash
|
|
45
|
+
topicId
|
|
46
|
+
topic {
|
|
47
|
+
id
|
|
48
|
+
name
|
|
49
|
+
typeId
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
completedCardsCount
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
exports.USER_SETTINGS_FIELDS = (0, client_1.gql) `
|
|
58
|
+
fragment UserSettingsFields on UserSettings {
|
|
59
|
+
id
|
|
60
|
+
userId
|
|
61
|
+
updatedAt
|
|
62
|
+
globalSettings {
|
|
63
|
+
dailyFeedMax
|
|
64
|
+
dailyFeedResetTime
|
|
65
|
+
theme
|
|
66
|
+
expandedReading
|
|
67
|
+
disabledColors
|
|
68
|
+
readingTextScale
|
|
69
|
+
addToDailyFlashcards
|
|
70
|
+
}
|
|
71
|
+
productSettings {
|
|
72
|
+
feedback
|
|
73
|
+
rating
|
|
74
|
+
examDate
|
|
75
|
+
nextFeedbackDate
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
5
79
|
exports.USER_FIELDS = (0, client_1.gql) `
|
|
80
|
+
${exports.USER_SETTINGS_FIELDS}
|
|
6
81
|
fragment UserFields on User {
|
|
7
82
|
id
|
|
8
83
|
accessLevel
|
|
@@ -15,9 +90,9 @@ exports.USER_FIELDS = (0, client_1.gql) `
|
|
|
15
90
|
classYear
|
|
16
91
|
graduationYear
|
|
17
92
|
universityId
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
93
|
+
settings {
|
|
94
|
+
...UserSettingsFields
|
|
95
|
+
}
|
|
21
96
|
stripeCustomerId
|
|
22
97
|
tocAccepted
|
|
23
98
|
|
|
@@ -76,55 +151,12 @@ exports.USER_FIELDS = (0, client_1.gql) `
|
|
|
76
151
|
# completedRedCardsCount
|
|
77
152
|
}
|
|
78
153
|
`;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
concept {
|
|
86
|
-
id
|
|
87
|
-
name
|
|
88
|
-
}
|
|
89
|
-
lastSeen
|
|
90
|
-
reviewDate
|
|
91
|
-
score
|
|
92
|
-
iteration
|
|
93
|
-
optimalFactor
|
|
94
|
-
cardId
|
|
95
|
-
card {
|
|
96
|
-
id
|
|
97
|
-
conceptId
|
|
98
|
-
concept {
|
|
99
|
-
id
|
|
100
|
-
name
|
|
101
|
-
}
|
|
102
|
-
topic {
|
|
103
|
-
id
|
|
104
|
-
name
|
|
105
|
-
}
|
|
106
|
-
question
|
|
107
|
-
explanation
|
|
108
|
-
pictures {
|
|
109
|
-
id
|
|
110
|
-
createdAt
|
|
111
|
-
updatedAt
|
|
112
|
-
name
|
|
113
|
-
caption
|
|
114
|
-
index
|
|
115
|
-
path
|
|
116
|
-
path512
|
|
117
|
-
path256
|
|
118
|
-
thumbhash
|
|
119
|
-
topicId
|
|
120
|
-
topic {
|
|
121
|
-
id
|
|
122
|
-
name
|
|
123
|
-
typeId
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
154
|
+
// used in cache updator
|
|
155
|
+
exports.UPDATE_USER_SETTINGS_FRAGMENT = (0, client_1.gql) `
|
|
156
|
+
${exports.USER_SETTINGS_FIELDS}
|
|
157
|
+
fragment UpdateUserSettingsFragment on User {
|
|
158
|
+
settings {
|
|
159
|
+
...UserSettingsFields
|
|
127
160
|
}
|
|
128
|
-
completedCardsCount
|
|
129
161
|
}
|
|
130
162
|
`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { EUserLearningStatus, IUser, IUserConceptStatus, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
|
|
2
|
+
import { EUserLearningStatus, IUser, IUserConceptStatus, IUserSettings, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
5
|
export declare const LOGOUT_USER: import("@apollo/client").DocumentNode;
|
|
@@ -31,9 +31,6 @@ export interface IUserInput {
|
|
|
31
31
|
graduationYear?: number;
|
|
32
32
|
password?: string;
|
|
33
33
|
oldPassword?: string;
|
|
34
|
-
examDate?: number | Date;
|
|
35
|
-
dailyFeedResetTime?: number;
|
|
36
|
-
dailyFeedMax?: number;
|
|
37
34
|
referral?: string;
|
|
38
35
|
universityId?: number;
|
|
39
36
|
}
|
|
@@ -46,6 +43,12 @@ export type IUpdateUserData = RestrictedData<{
|
|
|
46
43
|
jwt: string;
|
|
47
44
|
user: IUser & graphqlNormalize;
|
|
48
45
|
}, 'updateUser'>;
|
|
46
|
+
export declare const UPDATE_USER_SETTINGS: import("@apollo/client").DocumentNode;
|
|
47
|
+
export interface IUpdateUserSettingsVar {
|
|
48
|
+
input: Omit<IUserSettings, 'id' | 'userId' | 'updatedAt'>;
|
|
49
|
+
}
|
|
50
|
+
export type IUpdateUserSettingsData = RestrictedData<IUserSettings & graphqlNormalize, 'updateUserSettings'>;
|
|
51
|
+
export declare const updateCacheOnUpdateUserSettings: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpdateUserSettingsData>, options: ApolloUpdateOptions<IUpdateUserSettingsVar>) => void;
|
|
49
52
|
export declare const RENEW_TOKEN: import("@apollo/client").DocumentNode;
|
|
50
53
|
export type IRenewTokenVar = null;
|
|
51
54
|
export type IRenewTokenData = RestrictedData<string, 'renewToken'>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.optimisticVideoLearningStatus = exports.updateCacheOnVideoLearningStatusUpdate = exports.UPSERT_USER_VIDEO_STATUS = exports.optimisticStationLearningStatus = exports.updateCacheOnStationLearningStatusUpdate = exports.UPSERT_USER_STATION_STATUS = exports.optimisticConceptLearningStatus = exports.updateCacheOnConceptLearningStatusUpdate = exports.UPSERT_USER_CONCEPT_STATUS = exports.TOC_ACCEPT = exports.RENEW_TOKEN = exports.UPDATE_USER = exports.DELETE_USER = exports.RESET_CATEGORY_PROGRESS = exports.RESET_PROGRESS = exports.LOGOUT_USER = void 0;
|
|
3
|
+
exports.optimisticVideoLearningStatus = exports.updateCacheOnVideoLearningStatusUpdate = exports.UPSERT_USER_VIDEO_STATUS = exports.optimisticStationLearningStatus = exports.updateCacheOnStationLearningStatusUpdate = exports.UPSERT_USER_STATION_STATUS = exports.optimisticConceptLearningStatus = exports.updateCacheOnConceptLearningStatusUpdate = exports.UPSERT_USER_CONCEPT_STATUS = exports.TOC_ACCEPT = exports.RENEW_TOKEN = exports.updateCacheOnUpdateUserSettings = exports.UPDATE_USER_SETTINGS = exports.UPDATE_USER = exports.DELETE_USER = exports.RESET_CATEGORY_PROGRESS = exports.RESET_PROGRESS = exports.LOGOUT_USER = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const models_1 = require("../../../models");
|
|
6
|
+
const fragments_1 = require("../../fragments");
|
|
6
7
|
exports.LOGOUT_USER = (0, client_1.gql) `
|
|
7
8
|
mutation LogoutUser($all: Boolean!) {
|
|
8
9
|
restricted {
|
|
@@ -55,15 +56,40 @@ exports.UPDATE_USER = (0, client_1.gql) `
|
|
|
55
56
|
classYear
|
|
56
57
|
graduationYear
|
|
57
58
|
universityId
|
|
58
|
-
examDate
|
|
59
|
-
dailyFeedMax
|
|
60
|
-
dailyFeedResetTime
|
|
61
59
|
tocAccepted
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
64
|
`;
|
|
65
|
+
exports.UPDATE_USER_SETTINGS = (0, client_1.gql) `
|
|
66
|
+
${fragments_1.USER_SETTINGS_FIELDS}
|
|
67
|
+
mutation UpdateUserSettings($input: UserSettingsInput!) {
|
|
68
|
+
restricted {
|
|
69
|
+
updateUserSettings(input: $input) {
|
|
70
|
+
...UserSettingsFields
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
const updateCacheOnUpdateUserSettings = (cache, result, options) => {
|
|
76
|
+
const { updateUserSettings } = result?.data?.restricted || {};
|
|
77
|
+
const { variables } = options || {};
|
|
78
|
+
if (!variables || !updateUserSettings) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
cache.writeFragment({
|
|
82
|
+
id: cache.identify({
|
|
83
|
+
id: updateUserSettings.userId,
|
|
84
|
+
__typename: 'User',
|
|
85
|
+
}),
|
|
86
|
+
data: {
|
|
87
|
+
settings: updateUserSettings,
|
|
88
|
+
},
|
|
89
|
+
fragment: fragments_1.UPDATE_USER_SETTINGS_FRAGMENT,
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
exports.updateCacheOnUpdateUserSettings = updateCacheOnUpdateUserSettings;
|
|
67
93
|
exports.RENEW_TOKEN = (0, client_1.gql) `
|
|
68
94
|
mutation RenewToken {
|
|
69
95
|
restricted {
|
|
@@ -11,7 +11,14 @@ exports.DASHBOARD_QBANK = (0, client_1.gql) `
|
|
|
11
11
|
latestSessionId
|
|
12
12
|
user {
|
|
13
13
|
id
|
|
14
|
-
|
|
14
|
+
settings {
|
|
15
|
+
productSettings {
|
|
16
|
+
examDate
|
|
17
|
+
rating
|
|
18
|
+
feedback
|
|
19
|
+
nextFeedbackDate
|
|
20
|
+
}
|
|
21
|
+
}
|
|
15
22
|
completedQuestionsCount
|
|
16
23
|
completedCorrectQuestionsCount
|
|
17
24
|
completedIncorrectQuestionsCount
|
|
@@ -136,7 +143,14 @@ exports.DASHBOARD = (0, client_1.gql) `
|
|
|
136
143
|
latestSessionId
|
|
137
144
|
user {
|
|
138
145
|
id
|
|
139
|
-
|
|
146
|
+
settings {
|
|
147
|
+
productSettings {
|
|
148
|
+
examDate
|
|
149
|
+
rating
|
|
150
|
+
feedback
|
|
151
|
+
nextFeedbackDate
|
|
152
|
+
}
|
|
153
|
+
}
|
|
140
154
|
universityId
|
|
141
155
|
classYear
|
|
142
156
|
completedQuestionsCount
|
|
@@ -19,6 +19,10 @@ export declare enum IAccessLevel {
|
|
|
19
19
|
DEMO = "demo",
|
|
20
20
|
EXPIRED = "expired"
|
|
21
21
|
}
|
|
22
|
+
export declare enum ETheme {
|
|
23
|
+
LIGHT = 0,
|
|
24
|
+
DARK = 1
|
|
25
|
+
}
|
|
22
26
|
export type IClassYear = 'Year 1' | 'Year 2' | 'Year 3' | 'Year 4' | 'Year 5' | 'Graduated' | 'PhD' | 'BSc' | 'MSc' | 'Beta Tester';
|
|
23
27
|
export declare const classYears: IClassYear[];
|
|
24
28
|
export declare const subscriptionDates: IUserSubsriptionDates[];
|
|
@@ -92,6 +96,26 @@ export interface IUserProgressData {
|
|
|
92
96
|
daysInPreviousStreak: number;
|
|
93
97
|
daysInLongestStreak: number;
|
|
94
98
|
}
|
|
99
|
+
export interface IUserSettings {
|
|
100
|
+
id: Id;
|
|
101
|
+
userId: Id;
|
|
102
|
+
updatedAt: number | Date;
|
|
103
|
+
globalSettings: {
|
|
104
|
+
dailyFeedResetTime: number;
|
|
105
|
+
dailyFeedMax: number;
|
|
106
|
+
theme: ETheme;
|
|
107
|
+
disabledColors: boolean;
|
|
108
|
+
expandedReading: boolean;
|
|
109
|
+
readingTextScale: number;
|
|
110
|
+
addToDailyFlashcards: boolean;
|
|
111
|
+
};
|
|
112
|
+
productSettings: {
|
|
113
|
+
examDate: number | Date | null;
|
|
114
|
+
nextFeedbackDate: number | Date;
|
|
115
|
+
feedback: string | null;
|
|
116
|
+
rating: number | null;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
95
119
|
export interface IUser {
|
|
96
120
|
id: Id;
|
|
97
121
|
createdAt: number | Date;
|
|
@@ -101,8 +125,6 @@ export interface IUser {
|
|
|
101
125
|
firstName: string;
|
|
102
126
|
lastName: string;
|
|
103
127
|
tocAccepted: boolean;
|
|
104
|
-
dailyFeedResetTime: number;
|
|
105
|
-
dailyFeedMax: number;
|
|
106
128
|
stripeCustomerId: string;
|
|
107
129
|
stripeLastSyncAt: number | Date | null;
|
|
108
130
|
referralCount: number;
|
|
@@ -110,7 +132,6 @@ export interface IUser {
|
|
|
110
132
|
graduationYear: number;
|
|
111
133
|
universityId: Id;
|
|
112
134
|
university: IUniversity;
|
|
113
|
-
examDate: number | Date | null;
|
|
114
135
|
accessLevel: IAccessLevel;
|
|
115
136
|
elo: number;
|
|
116
137
|
marksheets: IMarksheet[];
|
|
@@ -145,6 +166,7 @@ export interface IUser {
|
|
|
145
166
|
radiologyInterviewSubscriptionEndDate: number | Date | null;
|
|
146
167
|
plab1SubscriptionEndDate: number | Date | null;
|
|
147
168
|
plab2SubscriptionEndDate: number | Date | null;
|
|
169
|
+
settings: IUserSettings;
|
|
148
170
|
}
|
|
149
171
|
export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear, compareUnix?: number): IClassYear;
|
|
150
172
|
export declare function currentClassGroup(createdAtUnix: number, classYear: IClassYear): EClassYearGroup;
|
package/dist/mjs/models/User.js
CHANGED
|
@@ -8,6 +8,11 @@ export var IAccessLevel;
|
|
|
8
8
|
IAccessLevel["DEMO"] = "demo";
|
|
9
9
|
IAccessLevel["EXPIRED"] = "expired";
|
|
10
10
|
})(IAccessLevel || (IAccessLevel = {}));
|
|
11
|
+
export var ETheme;
|
|
12
|
+
(function (ETheme) {
|
|
13
|
+
ETheme[ETheme["LIGHT"] = 0] = "LIGHT";
|
|
14
|
+
ETheme[ETheme["DARK"] = 1] = "DARK";
|
|
15
|
+
})(ETheme || (ETheme = {}));
|
|
11
16
|
export const classYears = [
|
|
12
17
|
'Year 1',
|
|
13
18
|
'Year 2',
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export declare const USER_FIELDS: import("@apollo/client").DocumentNode;
|
|
2
1
|
export declare const COMPLETED_CARDS: import("@apollo/client").DocumentNode;
|
|
2
|
+
export declare const USER_SETTINGS_FIELDS: import("@apollo/client").DocumentNode;
|
|
3
|
+
export declare const USER_FIELDS: import("@apollo/client").DocumentNode;
|
|
4
|
+
export declare const UPDATE_USER_SETTINGS_FRAGMENT: import("@apollo/client").DocumentNode;
|
|
@@ -1,5 +1,80 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
|
+
export const COMPLETED_CARDS = gql `
|
|
3
|
+
fragment UserCompletedCards on User {
|
|
4
|
+
completedCards {
|
|
5
|
+
id
|
|
6
|
+
createdAt
|
|
7
|
+
updatedAt
|
|
8
|
+
concept {
|
|
9
|
+
id
|
|
10
|
+
name
|
|
11
|
+
}
|
|
12
|
+
lastSeen
|
|
13
|
+
reviewDate
|
|
14
|
+
score
|
|
15
|
+
iteration
|
|
16
|
+
optimalFactor
|
|
17
|
+
cardId
|
|
18
|
+
card {
|
|
19
|
+
id
|
|
20
|
+
conceptId
|
|
21
|
+
concept {
|
|
22
|
+
id
|
|
23
|
+
name
|
|
24
|
+
}
|
|
25
|
+
topic {
|
|
26
|
+
id
|
|
27
|
+
name
|
|
28
|
+
}
|
|
29
|
+
question
|
|
30
|
+
explanation
|
|
31
|
+
pictures {
|
|
32
|
+
id
|
|
33
|
+
createdAt
|
|
34
|
+
updatedAt
|
|
35
|
+
name
|
|
36
|
+
caption
|
|
37
|
+
index
|
|
38
|
+
path
|
|
39
|
+
path512
|
|
40
|
+
path256
|
|
41
|
+
thumbhash
|
|
42
|
+
topicId
|
|
43
|
+
topic {
|
|
44
|
+
id
|
|
45
|
+
name
|
|
46
|
+
typeId
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
completedCardsCount
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
export const USER_SETTINGS_FIELDS = gql `
|
|
55
|
+
fragment UserSettingsFields on UserSettings {
|
|
56
|
+
id
|
|
57
|
+
userId
|
|
58
|
+
updatedAt
|
|
59
|
+
globalSettings {
|
|
60
|
+
dailyFeedMax
|
|
61
|
+
dailyFeedResetTime
|
|
62
|
+
theme
|
|
63
|
+
expandedReading
|
|
64
|
+
disabledColors
|
|
65
|
+
readingTextScale
|
|
66
|
+
addToDailyFlashcards
|
|
67
|
+
}
|
|
68
|
+
productSettings {
|
|
69
|
+
feedback
|
|
70
|
+
rating
|
|
71
|
+
examDate
|
|
72
|
+
nextFeedbackDate
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
2
76
|
export const USER_FIELDS = gql `
|
|
77
|
+
${USER_SETTINGS_FIELDS}
|
|
3
78
|
fragment UserFields on User {
|
|
4
79
|
id
|
|
5
80
|
accessLevel
|
|
@@ -12,9 +87,9 @@ export const USER_FIELDS = gql `
|
|
|
12
87
|
classYear
|
|
13
88
|
graduationYear
|
|
14
89
|
universityId
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
90
|
+
settings {
|
|
91
|
+
...UserSettingsFields
|
|
92
|
+
}
|
|
18
93
|
stripeCustomerId
|
|
19
94
|
tocAccepted
|
|
20
95
|
|
|
@@ -73,55 +148,12 @@ export const USER_FIELDS = gql `
|
|
|
73
148
|
# completedRedCardsCount
|
|
74
149
|
}
|
|
75
150
|
`;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
concept {
|
|
83
|
-
id
|
|
84
|
-
name
|
|
85
|
-
}
|
|
86
|
-
lastSeen
|
|
87
|
-
reviewDate
|
|
88
|
-
score
|
|
89
|
-
iteration
|
|
90
|
-
optimalFactor
|
|
91
|
-
cardId
|
|
92
|
-
card {
|
|
93
|
-
id
|
|
94
|
-
conceptId
|
|
95
|
-
concept {
|
|
96
|
-
id
|
|
97
|
-
name
|
|
98
|
-
}
|
|
99
|
-
topic {
|
|
100
|
-
id
|
|
101
|
-
name
|
|
102
|
-
}
|
|
103
|
-
question
|
|
104
|
-
explanation
|
|
105
|
-
pictures {
|
|
106
|
-
id
|
|
107
|
-
createdAt
|
|
108
|
-
updatedAt
|
|
109
|
-
name
|
|
110
|
-
caption
|
|
111
|
-
index
|
|
112
|
-
path
|
|
113
|
-
path512
|
|
114
|
-
path256
|
|
115
|
-
thumbhash
|
|
116
|
-
topicId
|
|
117
|
-
topic {
|
|
118
|
-
id
|
|
119
|
-
name
|
|
120
|
-
typeId
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
151
|
+
// used in cache updator
|
|
152
|
+
export const UPDATE_USER_SETTINGS_FRAGMENT = gql `
|
|
153
|
+
${USER_SETTINGS_FIELDS}
|
|
154
|
+
fragment UpdateUserSettingsFragment on User {
|
|
155
|
+
settings {
|
|
156
|
+
...UserSettingsFields
|
|
124
157
|
}
|
|
125
|
-
completedCardsCount
|
|
126
158
|
}
|
|
127
159
|
`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { EUserLearningStatus, IUser, IUserConceptStatus, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
|
|
2
|
+
import { EUserLearningStatus, IUser, IUserConceptStatus, IUserSettings, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
5
|
export declare const LOGOUT_USER: import("@apollo/client").DocumentNode;
|
|
@@ -31,9 +31,6 @@ export interface IUserInput {
|
|
|
31
31
|
graduationYear?: number;
|
|
32
32
|
password?: string;
|
|
33
33
|
oldPassword?: string;
|
|
34
|
-
examDate?: number | Date;
|
|
35
|
-
dailyFeedResetTime?: number;
|
|
36
|
-
dailyFeedMax?: number;
|
|
37
34
|
referral?: string;
|
|
38
35
|
universityId?: number;
|
|
39
36
|
}
|
|
@@ -46,6 +43,12 @@ export type IUpdateUserData = RestrictedData<{
|
|
|
46
43
|
jwt: string;
|
|
47
44
|
user: IUser & graphqlNormalize;
|
|
48
45
|
}, 'updateUser'>;
|
|
46
|
+
export declare const UPDATE_USER_SETTINGS: import("@apollo/client").DocumentNode;
|
|
47
|
+
export interface IUpdateUserSettingsVar {
|
|
48
|
+
input: Omit<IUserSettings, 'id' | 'userId' | 'updatedAt'>;
|
|
49
|
+
}
|
|
50
|
+
export type IUpdateUserSettingsData = RestrictedData<IUserSettings & graphqlNormalize, 'updateUserSettings'>;
|
|
51
|
+
export declare const updateCacheOnUpdateUserSettings: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpdateUserSettingsData>, options: ApolloUpdateOptions<IUpdateUserSettingsVar>) => void;
|
|
49
52
|
export declare const RENEW_TOKEN: import("@apollo/client").DocumentNode;
|
|
50
53
|
export type IRenewTokenVar = null;
|
|
51
54
|
export type IRenewTokenData = RestrictedData<string, 'renewToken'>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { EUserLearningStatus, } from '../../../models';
|
|
3
|
+
import { UPDATE_USER_SETTINGS_FRAGMENT, USER_SETTINGS_FIELDS, } from '../../fragments';
|
|
3
4
|
export const LOGOUT_USER = gql `
|
|
4
5
|
mutation LogoutUser($all: Boolean!) {
|
|
5
6
|
restricted {
|
|
@@ -52,15 +53,39 @@ export const UPDATE_USER = gql `
|
|
|
52
53
|
classYear
|
|
53
54
|
graduationYear
|
|
54
55
|
universityId
|
|
55
|
-
examDate
|
|
56
|
-
dailyFeedMax
|
|
57
|
-
dailyFeedResetTime
|
|
58
56
|
tocAccepted
|
|
59
57
|
}
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
61
|
`;
|
|
62
|
+
export const UPDATE_USER_SETTINGS = gql `
|
|
63
|
+
${USER_SETTINGS_FIELDS}
|
|
64
|
+
mutation UpdateUserSettings($input: UserSettingsInput!) {
|
|
65
|
+
restricted {
|
|
66
|
+
updateUserSettings(input: $input) {
|
|
67
|
+
...UserSettingsFields
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
export const updateCacheOnUpdateUserSettings = (cache, result, options) => {
|
|
73
|
+
const { updateUserSettings } = result?.data?.restricted || {};
|
|
74
|
+
const { variables } = options || {};
|
|
75
|
+
if (!variables || !updateUserSettings) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
cache.writeFragment({
|
|
79
|
+
id: cache.identify({
|
|
80
|
+
id: updateUserSettings.userId,
|
|
81
|
+
__typename: 'User',
|
|
82
|
+
}),
|
|
83
|
+
data: {
|
|
84
|
+
settings: updateUserSettings,
|
|
85
|
+
},
|
|
86
|
+
fragment: UPDATE_USER_SETTINGS_FRAGMENT,
|
|
87
|
+
});
|
|
88
|
+
};
|
|
64
89
|
export const RENEW_TOKEN = gql `
|
|
65
90
|
mutation RenewToken {
|
|
66
91
|
restricted {
|
|
@@ -8,7 +8,14 @@ export const DASHBOARD_QBANK = gql `
|
|
|
8
8
|
latestSessionId
|
|
9
9
|
user {
|
|
10
10
|
id
|
|
11
|
-
|
|
11
|
+
settings {
|
|
12
|
+
productSettings {
|
|
13
|
+
examDate
|
|
14
|
+
rating
|
|
15
|
+
feedback
|
|
16
|
+
nextFeedbackDate
|
|
17
|
+
}
|
|
18
|
+
}
|
|
12
19
|
completedQuestionsCount
|
|
13
20
|
completedCorrectQuestionsCount
|
|
14
21
|
completedIncorrectQuestionsCount
|
|
@@ -133,7 +140,14 @@ export const DASHBOARD = gql `
|
|
|
133
140
|
latestSessionId
|
|
134
141
|
user {
|
|
135
142
|
id
|
|
136
|
-
|
|
143
|
+
settings {
|
|
144
|
+
productSettings {
|
|
145
|
+
examDate
|
|
146
|
+
rating
|
|
147
|
+
feedback
|
|
148
|
+
nextFeedbackDate
|
|
149
|
+
}
|
|
150
|
+
}
|
|
137
151
|
universityId
|
|
138
152
|
classYear
|
|
139
153
|
completedQuestionsCount
|