@quesmed/types 1.4.21 → 1.4.25
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/index.d.ts +1 -0
- package/index.js +5 -4
- package/index.mjs +1 -0
- package/models/User.d.ts +10 -0
- package/models/User.js +68 -0
- package/models/User.mjs +65 -1
- package/models/index.d.ts +1 -1
- package/models/index.js +1 -1
- package/models/index.mjs +1 -1
- package/package.json +1 -1
- package/resolvers/mutation/index.d.ts +3 -0
- package/resolvers/mutation/index.js +16 -0
- package/resolvers/mutation/index.mjs +3 -0
- package/resolvers/query/index.d.ts +2 -0
- package/resolvers/query/index.js +15 -0
- package/resolvers/query/index.mjs +2 -0
- package/resolvers/subscription/osce.d.ts +4 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -11,9 +11,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
11
|
}) : function(o, v) {
|
|
12
12
|
o["default"] = v;
|
|
13
13
|
});
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
15
|
if (mod && mod.__esModule) return mod;
|
|
19
16
|
var result = {};
|
|
@@ -21,8 +18,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
21
18
|
__setModuleDefault(result, mod);
|
|
22
19
|
return result;
|
|
23
20
|
};
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.termsAndConditions = exports.EPlatformId = exports.FCM_TOPICS = exports.ERRORS = exports.utils = void 0;
|
|
25
|
+
exports.termsAndConditions = exports.EPlatformId = exports.FCM_TOPICS = exports.ERRORS = exports.utils = exports.Models = void 0;
|
|
26
|
+
exports.Models = __importStar(require("./models"));
|
|
26
27
|
__exportStar(require("./resolvers"), exports);
|
|
27
28
|
exports.utils = __importStar(require("./utils"));
|
|
28
29
|
exports.ERRORS = {
|
package/index.mjs
CHANGED
package/models/User.d.ts
CHANGED
|
@@ -6,6 +6,14 @@ import { ISubscription } from './Subscription';
|
|
|
6
6
|
import { ITopic } from './Topic';
|
|
7
7
|
import { Id } from './Type';
|
|
8
8
|
export declare type IClassYear = 'Year 1' | 'Year 2' | 'Year 3' | 'Year 4' | 'Year 5' | 'Graduated' | 'PhD' | 'BSc' | 'MSc' | 'Beta Tester';
|
|
9
|
+
export declare const classYears: IClassYear[];
|
|
10
|
+
export declare enum EClassYearGroup {
|
|
11
|
+
PRECLINICAL = 0,
|
|
12
|
+
CLINICAL = 1
|
|
13
|
+
}
|
|
14
|
+
export declare const classYearGroup: {
|
|
15
|
+
[key: string]: EClassYearGroup;
|
|
16
|
+
};
|
|
9
17
|
export interface IPayload {
|
|
10
18
|
id: Id;
|
|
11
19
|
displayName: string;
|
|
@@ -46,6 +54,8 @@ export interface IUser {
|
|
|
46
54
|
stripeSubscriptionEndDate: number | Date | null;
|
|
47
55
|
stripePriceNickname: string | null;
|
|
48
56
|
}
|
|
57
|
+
export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear): IClassYear;
|
|
58
|
+
export declare function currentClassGroup(createdAtUnix: number, classYear: IClassYear): EClassYearGroup;
|
|
49
59
|
export interface IUserCompletedQuestions {
|
|
50
60
|
id: Id;
|
|
51
61
|
createdAt: number | Date;
|
package/models/User.js
CHANGED
|
@@ -1,2 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.currentClassGroup = exports.currentClassYear = exports.classYearGroup = exports.EClassYearGroup = exports.classYears = void 0;
|
|
4
|
+
exports.classYears = [
|
|
5
|
+
'Year 1',
|
|
6
|
+
'Year 2',
|
|
7
|
+
'Year 3',
|
|
8
|
+
'Year 4',
|
|
9
|
+
'Year 5',
|
|
10
|
+
'Graduated',
|
|
11
|
+
];
|
|
12
|
+
var EClassYearGroup;
|
|
13
|
+
(function (EClassYearGroup) {
|
|
14
|
+
EClassYearGroup[EClassYearGroup["PRECLINICAL"] = 0] = "PRECLINICAL";
|
|
15
|
+
EClassYearGroup[EClassYearGroup["CLINICAL"] = 1] = "CLINICAL";
|
|
16
|
+
})(EClassYearGroup = exports.EClassYearGroup || (exports.EClassYearGroup = {}));
|
|
17
|
+
exports.classYearGroup = {
|
|
18
|
+
'Year 1': EClassYearGroup.PRECLINICAL,
|
|
19
|
+
'Year 2': EClassYearGroup.PRECLINICAL,
|
|
20
|
+
'Year 3': EClassYearGroup.CLINICAL,
|
|
21
|
+
'Year 4': EClassYearGroup.CLINICAL,
|
|
22
|
+
'Year 5': EClassYearGroup.CLINICAL,
|
|
23
|
+
Graduated: EClassYearGroup.CLINICAL,
|
|
24
|
+
PhD: EClassYearGroup.CLINICAL,
|
|
25
|
+
BSc: EClassYearGroup.PRECLINICAL,
|
|
26
|
+
MSc: EClassYearGroup.CLINICAL,
|
|
27
|
+
'Beta Tester': EClassYearGroup.CLINICAL,
|
|
28
|
+
};
|
|
29
|
+
function currentClassYear(createdAtUnix, classYear) {
|
|
30
|
+
if (createdAtUnix === 0) {
|
|
31
|
+
throw new Error('createdAt not given in Unix');
|
|
32
|
+
}
|
|
33
|
+
if (!createdAtUnix) {
|
|
34
|
+
return classYear;
|
|
35
|
+
}
|
|
36
|
+
const lastClassYearIdx = exports.classYears.length - 1;
|
|
37
|
+
const classYearsIdx = exports.classYears.findIndex((x) => x === classYear);
|
|
38
|
+
if (classYearsIdx === -1) {
|
|
39
|
+
return exports.classYears[lastClassYearIdx];
|
|
40
|
+
}
|
|
41
|
+
const now = new Date();
|
|
42
|
+
const currentYear = now.getFullYear();
|
|
43
|
+
const createdAt = new Date(createdAtUnix * 1000);
|
|
44
|
+
if (createdAt.getFullYear() > now.getFullYear()) {
|
|
45
|
+
throw new Error('createdAt not given in Unix');
|
|
46
|
+
}
|
|
47
|
+
const createdYear = createdAt.getFullYear();
|
|
48
|
+
let yearsAdded = currentYear - createdYear;
|
|
49
|
+
const createdAcademicYear = new Date(createdYear, 7, 1);
|
|
50
|
+
const nowAcademicYear = new Date(currentYear, 7, 1);
|
|
51
|
+
if (createdAt > createdAcademicYear) {
|
|
52
|
+
yearsAdded--;
|
|
53
|
+
}
|
|
54
|
+
if (now > nowAcademicYear) {
|
|
55
|
+
yearsAdded++;
|
|
56
|
+
}
|
|
57
|
+
const newClassYearIdx = classYearsIdx + yearsAdded;
|
|
58
|
+
return newClassYearIdx > lastClassYearIdx
|
|
59
|
+
? exports.classYears[lastClassYearIdx]
|
|
60
|
+
: exports.classYears[newClassYearIdx];
|
|
61
|
+
}
|
|
62
|
+
exports.currentClassYear = currentClassYear;
|
|
63
|
+
function currentClassGroup(createdAtUnix, classYear) {
|
|
64
|
+
const currentClass = currentClassYear(createdAtUnix, classYear);
|
|
65
|
+
if (!exports.classYearGroup.hasOwnProperty(currentClass)) {
|
|
66
|
+
return EClassYearGroup.CLINICAL;
|
|
67
|
+
}
|
|
68
|
+
return exports.classYearGroup[currentClass];
|
|
69
|
+
}
|
|
70
|
+
exports.currentClassGroup = currentClassGroup;
|
package/models/User.mjs
CHANGED
|
@@ -1 +1,65 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const classYears = [
|
|
2
|
+
'Year 1',
|
|
3
|
+
'Year 2',
|
|
4
|
+
'Year 3',
|
|
5
|
+
'Year 4',
|
|
6
|
+
'Year 5',
|
|
7
|
+
'Graduated',
|
|
8
|
+
];
|
|
9
|
+
export var EClassYearGroup;
|
|
10
|
+
(function (EClassYearGroup) {
|
|
11
|
+
EClassYearGroup[EClassYearGroup["PRECLINICAL"] = 0] = "PRECLINICAL";
|
|
12
|
+
EClassYearGroup[EClassYearGroup["CLINICAL"] = 1] = "CLINICAL";
|
|
13
|
+
})(EClassYearGroup || (EClassYearGroup = {}));
|
|
14
|
+
export const classYearGroup = {
|
|
15
|
+
'Year 1': EClassYearGroup.PRECLINICAL,
|
|
16
|
+
'Year 2': EClassYearGroup.PRECLINICAL,
|
|
17
|
+
'Year 3': EClassYearGroup.CLINICAL,
|
|
18
|
+
'Year 4': EClassYearGroup.CLINICAL,
|
|
19
|
+
'Year 5': EClassYearGroup.CLINICAL,
|
|
20
|
+
Graduated: EClassYearGroup.CLINICAL,
|
|
21
|
+
PhD: EClassYearGroup.CLINICAL,
|
|
22
|
+
BSc: EClassYearGroup.PRECLINICAL,
|
|
23
|
+
MSc: EClassYearGroup.CLINICAL,
|
|
24
|
+
'Beta Tester': EClassYearGroup.CLINICAL,
|
|
25
|
+
};
|
|
26
|
+
export function currentClassYear(createdAtUnix, classYear) {
|
|
27
|
+
if (createdAtUnix === 0) {
|
|
28
|
+
throw new Error('createdAt not given in Unix');
|
|
29
|
+
}
|
|
30
|
+
if (!createdAtUnix) {
|
|
31
|
+
return classYear;
|
|
32
|
+
}
|
|
33
|
+
const lastClassYearIdx = classYears.length - 1;
|
|
34
|
+
const classYearsIdx = classYears.findIndex((x) => x === classYear);
|
|
35
|
+
if (classYearsIdx === -1) {
|
|
36
|
+
return classYears[lastClassYearIdx];
|
|
37
|
+
}
|
|
38
|
+
const now = new Date();
|
|
39
|
+
const currentYear = now.getFullYear();
|
|
40
|
+
const createdAt = new Date(createdAtUnix * 1000);
|
|
41
|
+
if (createdAt.getFullYear() > now.getFullYear()) {
|
|
42
|
+
throw new Error('createdAt not given in Unix');
|
|
43
|
+
}
|
|
44
|
+
const createdYear = createdAt.getFullYear();
|
|
45
|
+
let yearsAdded = currentYear - createdYear;
|
|
46
|
+
const createdAcademicYear = new Date(createdYear, 7, 1);
|
|
47
|
+
const nowAcademicYear = new Date(currentYear, 7, 1);
|
|
48
|
+
if (createdAt > createdAcademicYear) {
|
|
49
|
+
yearsAdded--;
|
|
50
|
+
}
|
|
51
|
+
if (now > nowAcademicYear) {
|
|
52
|
+
yearsAdded++;
|
|
53
|
+
}
|
|
54
|
+
const newClassYearIdx = classYearsIdx + yearsAdded;
|
|
55
|
+
return newClassYearIdx > lastClassYearIdx
|
|
56
|
+
? classYears[lastClassYearIdx]
|
|
57
|
+
: classYears[newClassYearIdx];
|
|
58
|
+
}
|
|
59
|
+
export function currentClassGroup(createdAtUnix, classYear) {
|
|
60
|
+
const currentClass = currentClassYear(createdAtUnix, classYear);
|
|
61
|
+
if (!classYearGroup.hasOwnProperty(currentClass)) {
|
|
62
|
+
return EClassYearGroup.CLINICAL;
|
|
63
|
+
}
|
|
64
|
+
return classYearGroup[currentClass];
|
|
65
|
+
}
|
package/models/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './Author';
|
|
2
|
+
export * from './Blog';
|
|
2
3
|
export * from './Book';
|
|
3
4
|
export * from './Card';
|
|
4
5
|
export * from './Chapter';
|
|
@@ -21,4 +22,3 @@ export * from './Type';
|
|
|
21
22
|
export * from './University';
|
|
22
23
|
export * from './User';
|
|
23
24
|
export * from './Video';
|
|
24
|
-
export * from './Blog';
|
package/models/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./Author"), exports);
|
|
14
|
+
__exportStar(require("./Blog"), exports);
|
|
14
15
|
__exportStar(require("./Book"), exports);
|
|
15
16
|
__exportStar(require("./Card"), exports);
|
|
16
17
|
__exportStar(require("./Chapter"), exports);
|
|
@@ -33,4 +34,3 @@ __exportStar(require("./Type"), exports);
|
|
|
33
34
|
__exportStar(require("./University"), exports);
|
|
34
35
|
__exportStar(require("./User"), exports);
|
|
35
36
|
__exportStar(require("./Video"), exports);
|
|
36
|
-
__exportStar(require("./Blog"), exports);
|
package/models/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './Author';
|
|
2
|
+
export * from './Blog';
|
|
2
3
|
export * from './Book';
|
|
3
4
|
export * from './Card';
|
|
4
5
|
export * from './Chapter';
|
|
@@ -21,4 +22,3 @@ export * from './Type';
|
|
|
21
22
|
export * from './University';
|
|
22
23
|
export * from './User';
|
|
23
24
|
export * from './Video';
|
|
24
|
-
export * from './Blog';
|
package/package.json
CHANGED
|
@@ -6,9 +6,25 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
6
6
|
if (k2 === undefined) k2 = k;
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
9
21
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
22
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
23
|
};
|
|
12
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.validUserToken = exports.restricted = exports.admin = void 0;
|
|
26
|
+
exports.admin = __importStar(require("./admin"));
|
|
27
|
+
exports.restricted = __importStar(require("./restricted"));
|
|
13
28
|
__exportStar(require("./stripe"), exports);
|
|
14
29
|
__exportStar(require("./users"), exports);
|
|
30
|
+
exports.validUserToken = __importStar(require("./validUserToken"));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export * as admin from './admin';
|
|
1
2
|
export * from './author';
|
|
2
3
|
export * from './blog';
|
|
3
4
|
export * from './book';
|
|
4
5
|
export * from './feedback';
|
|
6
|
+
export * as restricted from './restricted';
|
|
5
7
|
export * from './sampleCards';
|
|
6
8
|
export * from './sampleQuestions';
|
|
7
9
|
export * from './subscription';
|
package/resolvers/query/index.js
CHANGED
|
@@ -6,14 +6,29 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
6
6
|
if (k2 === undefined) k2 = k;
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
9
21
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
22
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
23
|
};
|
|
12
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.restricted = exports.admin = void 0;
|
|
26
|
+
exports.admin = __importStar(require("./admin"));
|
|
13
27
|
__exportStar(require("./author"), exports);
|
|
14
28
|
__exportStar(require("./blog"), exports);
|
|
15
29
|
__exportStar(require("./book"), exports);
|
|
16
30
|
__exportStar(require("./feedback"), exports);
|
|
31
|
+
exports.restricted = __importStar(require("./restricted"));
|
|
17
32
|
__exportStar(require("./sampleCards"), exports);
|
|
18
33
|
__exportStar(require("./sampleQuestions"), exports);
|
|
19
34
|
__exportStar(require("./subscription"), exports);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export * as admin from './admin';
|
|
1
2
|
export * from './author';
|
|
2
3
|
export * from './blog';
|
|
3
4
|
export * from './book';
|
|
4
5
|
export * from './feedback';
|
|
6
|
+
export * as restricted from './restricted';
|
|
5
7
|
export * from './sampleCards';
|
|
6
8
|
export * from './sampleQuestions';
|
|
7
9
|
export * from './subscription';
|
|
@@ -50,5 +50,8 @@ export interface IOsceMatchmakingVar {
|
|
|
50
50
|
userId: Id;
|
|
51
51
|
}
|
|
52
52
|
export declare const OSCE_MATCHMAKING_USERS: import("@apollo/client").DocumentNode;
|
|
53
|
-
export declare type IOsceMatchmakingUsersData = RootData<
|
|
53
|
+
export declare type IOsceMatchmakingUsersData = RootData<[
|
|
54
|
+
number,
|
|
55
|
+
number
|
|
56
|
+
], 'osceMatchmakingUsers'>;
|
|
54
57
|
export declare type IOsceMatchmakingUsersVar = null;
|