@quesmed/types-rn 2.2.54 → 2.2.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/models/Product.d.ts +17 -0
- package/models/Product.js +9 -0
- package/models/Promo.d.ts +1 -1
- package/models/Subscription.d.ts +13 -12
- package/models/Subscription.js +0 -7
- package/models/User.d.ts +8 -16
- package/models/User.js +5 -5
- package/models/index.d.ts +2 -1
- package/models/index.js +2 -1
- package/package.json +1 -1
- package/resolvers/fragments/user.js +3 -6
- package/resolvers/mutation/restricted/marksheet.d.ts +1 -1
- package/resolvers/mutation/restricted/marksheet.js +7 -3
- package/resolvers/query/index.d.ts +1 -1
- package/resolvers/query/index.js +1 -1
- package/resolvers/query/product.d.ts +4 -0
- package/resolvers/query/{subscription.js → product.js} +4 -4
- package/resolvers/query/restricted/marksheet.js +1 -0
- package/resolvers/query/subscription.d.ts +0 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Id } from './Type';
|
|
2
|
+
export declare enum EProductType {
|
|
3
|
+
QBANK = 1,
|
|
4
|
+
OSCE = 2,
|
|
5
|
+
BUNDLE = 3
|
|
6
|
+
}
|
|
7
|
+
export interface IProduct {
|
|
8
|
+
id: Id;
|
|
9
|
+
createdAt: number | Date;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string | null;
|
|
12
|
+
price: number;
|
|
13
|
+
stripePriceId: string;
|
|
14
|
+
duration: number;
|
|
15
|
+
public: boolean;
|
|
16
|
+
typeId: EProductType;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EProductType = void 0;
|
|
4
|
+
var EProductType;
|
|
5
|
+
(function (EProductType) {
|
|
6
|
+
EProductType[EProductType["QBANK"] = 1] = "QBANK";
|
|
7
|
+
EProductType[EProductType["OSCE"] = 2] = "OSCE";
|
|
8
|
+
EProductType[EProductType["BUNDLE"] = 3] = "BUNDLE";
|
|
9
|
+
})(EProductType = exports.EProductType || (exports.EProductType = {}));
|
package/models/Promo.d.ts
CHANGED
package/models/Subscription.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import { IProduct } from './Product';
|
|
1
2
|
import { Id } from './Type';
|
|
3
|
+
import { IClassYear, IUser } from './User';
|
|
2
4
|
export interface ISubscription {
|
|
3
5
|
id: Id;
|
|
4
6
|
createdAt: number | Date;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
BUNDLE = 3
|
|
7
|
+
updatedAt: number | Date;
|
|
8
|
+
startedAt: number | Date;
|
|
9
|
+
endedAt: number | Date;
|
|
10
|
+
periodEndAt: number | Date;
|
|
11
|
+
stripeSubscriptionId: string;
|
|
12
|
+
userId: Id;
|
|
13
|
+
user?: IUser;
|
|
14
|
+
productId: Id;
|
|
15
|
+
product?: IProduct;
|
|
16
|
+
classYear: IClassYear;
|
|
17
|
+
invoiced: number;
|
|
17
18
|
}
|
package/models/Subscription.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ESubscriptionType = void 0;
|
|
4
|
-
var ESubscriptionType;
|
|
5
|
-
(function (ESubscriptionType) {
|
|
6
|
-
ESubscriptionType[ESubscriptionType["QBANK"] = 1] = "QBANK";
|
|
7
|
-
ESubscriptionType[ESubscriptionType["OSCE"] = 2] = "OSCE";
|
|
8
|
-
ESubscriptionType[ESubscriptionType["BUNDLE"] = 3] = "BUNDLE";
|
|
9
|
-
})(ESubscriptionType = exports.ESubscriptionType || (exports.ESubscriptionType = {}));
|
package/models/User.d.ts
CHANGED
|
@@ -26,9 +26,9 @@ export interface IPayload {
|
|
|
26
26
|
accessLevel: IAccessLevel;
|
|
27
27
|
tocAccepted: boolean;
|
|
28
28
|
exp: number;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
qbankSubscriptionEndDate: number | null;
|
|
30
|
+
osceSubscriptionEndDate: number | null;
|
|
31
|
+
bundleSubscriptionEndDate: number | null;
|
|
32
32
|
}
|
|
33
33
|
export interface IDailyProgressInfo {
|
|
34
34
|
totalCount: number;
|
|
@@ -48,18 +48,6 @@ export interface IUser {
|
|
|
48
48
|
dailyFeedMax: number;
|
|
49
49
|
stripeCustomerId: string;
|
|
50
50
|
stripeLastSyncAt: number | Date | null;
|
|
51
|
-
qBankSubscriptionId: Id;
|
|
52
|
-
qBankSubscription: ISubscription | null;
|
|
53
|
-
stripeQBankSubscriptionId: string;
|
|
54
|
-
stripeQBankSubscriptionEndDate: number | Date;
|
|
55
|
-
osceSubscriptionId: Id;
|
|
56
|
-
osceSubscription: ISubscription | null;
|
|
57
|
-
stripeOsceSubscriptionId: string;
|
|
58
|
-
stripeOsceSubscriptionEndDate: number | Date;
|
|
59
|
-
bundleSubscriptionId: Id;
|
|
60
|
-
bundleSubscription: ISubscription | null;
|
|
61
|
-
stripeBundleSubscriptionId: string;
|
|
62
|
-
stripeBundleSubscriptionEndDate: number | Date;
|
|
63
51
|
referralCount: number;
|
|
64
52
|
classYear: IClassYear;
|
|
65
53
|
graduationYear: number;
|
|
@@ -82,8 +70,12 @@ export interface IUser {
|
|
|
82
70
|
dailyFeed: ITodo;
|
|
83
71
|
dailyProgress: IDailyProgressInfo[];
|
|
84
72
|
notifications: INotification[];
|
|
73
|
+
subscriptions: ISubscription[];
|
|
74
|
+
qbankSubscriptionEndDate: number | Date | null;
|
|
75
|
+
osceSubscriptionEndDate: number | Date | null;
|
|
76
|
+
bundleSubscriptionEndDate: number | Date | null;
|
|
85
77
|
}
|
|
86
|
-
export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear): IClassYear;
|
|
78
|
+
export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear, compareUnix?: number): IClassYear;
|
|
87
79
|
export declare function currentClassGroup(createdAtUnix: number, classYear: IClassYear): EClassYearGroup;
|
|
88
80
|
export interface IUserCompletedQuestion {
|
|
89
81
|
id: Id;
|
package/models/User.js
CHANGED
|
@@ -26,7 +26,7 @@ exports.classYearGroup = {
|
|
|
26
26
|
MSc: EClassYearGroup.CLINICAL,
|
|
27
27
|
'Beta Tester': EClassYearGroup.CLINICAL,
|
|
28
28
|
};
|
|
29
|
-
function currentClassYear(createdAtUnix, classYear) {
|
|
29
|
+
function currentClassYear(createdAtUnix, classYear, compareUnix = new Date().getTime()) {
|
|
30
30
|
if (createdAtUnix === 0) {
|
|
31
31
|
throw new Error('createdAt not given in Unix');
|
|
32
32
|
}
|
|
@@ -38,10 +38,10 @@ function currentClassYear(createdAtUnix, classYear) {
|
|
|
38
38
|
if (classYearsIdx === -1) {
|
|
39
39
|
return exports.classYears[lastClassYearIdx];
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
const currentYear =
|
|
41
|
+
const compareDate = new Date(compareUnix * 1000);
|
|
42
|
+
const currentYear = compareDate.getFullYear();
|
|
43
43
|
const createdAt = new Date(createdAtUnix * 1000);
|
|
44
|
-
if (createdAt.getFullYear() >
|
|
44
|
+
if (createdAt.getFullYear() > compareDate.getFullYear()) {
|
|
45
45
|
throw new Error('createdAt not given in Unix');
|
|
46
46
|
}
|
|
47
47
|
const createdYear = createdAt.getFullYear();
|
|
@@ -51,7 +51,7 @@ function currentClassYear(createdAtUnix, classYear) {
|
|
|
51
51
|
if (createdAt > createdAcademicYear) {
|
|
52
52
|
yearsAdded--;
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
54
|
+
if (compareDate > nowAcademicYear) {
|
|
55
55
|
yearsAdded++;
|
|
56
56
|
}
|
|
57
57
|
const newClassYearIdx = classYearsIdx + yearsAdded;
|
package/models/index.d.ts
CHANGED
|
@@ -13,8 +13,10 @@ export * from './Notification';
|
|
|
13
13
|
export * from './OsceMarksheet';
|
|
14
14
|
export * from './OsceStation';
|
|
15
15
|
export * from './Picture';
|
|
16
|
+
export * from './Product';
|
|
16
17
|
export * from './Promo';
|
|
17
18
|
export * from './Question';
|
|
19
|
+
export * from './Referrals';
|
|
18
20
|
export * from './Subscription';
|
|
19
21
|
export * from './Todo';
|
|
20
22
|
export * from './Token';
|
|
@@ -23,4 +25,3 @@ export * from './Type';
|
|
|
23
25
|
export * from './University';
|
|
24
26
|
export * from './User';
|
|
25
27
|
export * from './Video';
|
|
26
|
-
export * from './Referrals';
|
package/models/index.js
CHANGED
|
@@ -25,8 +25,10 @@ __exportStar(require("./Notification"), exports);
|
|
|
25
25
|
__exportStar(require("./OsceMarksheet"), exports);
|
|
26
26
|
__exportStar(require("./OsceStation"), exports);
|
|
27
27
|
__exportStar(require("./Picture"), exports);
|
|
28
|
+
__exportStar(require("./Product"), exports);
|
|
28
29
|
__exportStar(require("./Promo"), exports);
|
|
29
30
|
__exportStar(require("./Question"), exports);
|
|
31
|
+
__exportStar(require("./Referrals"), exports);
|
|
30
32
|
__exportStar(require("./Subscription"), exports);
|
|
31
33
|
__exportStar(require("./Todo"), exports);
|
|
32
34
|
__exportStar(require("./Token"), exports);
|
|
@@ -35,4 +37,3 @@ __exportStar(require("./Type"), exports);
|
|
|
35
37
|
__exportStar(require("./University"), exports);
|
|
36
38
|
__exportStar(require("./User"), exports);
|
|
37
39
|
__exportStar(require("./Video"), exports);
|
|
38
|
-
__exportStar(require("./Referrals"), exports);
|
package/package.json
CHANGED
|
@@ -18,12 +18,9 @@ exports.USER_FIELDS = (0, client_1.gql) `
|
|
|
18
18
|
dailyFeedResetTime
|
|
19
19
|
dailyFeedMax
|
|
20
20
|
stripeCustomerId
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
stripeOsceSubscriptionEndDate
|
|
25
|
-
stripeBundleSubscriptionId
|
|
26
|
-
stripeBundleSubscriptionEndDate
|
|
21
|
+
qbankSubscriptionEndDate
|
|
22
|
+
osceSubscriptionEndDate
|
|
23
|
+
bundleSubscriptionEndDate
|
|
27
24
|
|
|
28
25
|
# user-specific keys
|
|
29
26
|
# marksheets
|
|
@@ -188,7 +188,7 @@ export declare const LEAVE_MARKSHEET: import("@apollo/client").DocumentNode;
|
|
|
188
188
|
export interface IEndMarksheetVar {
|
|
189
189
|
marksheetId: Id;
|
|
190
190
|
}
|
|
191
|
-
export declare type IEndMarksheetData = RestrictedData<graphqlNormalize &
|
|
191
|
+
export declare type IEndMarksheetData = RestrictedData<graphqlNormalize & IMarksheet, 'endMarksheet'>;
|
|
192
192
|
export declare const END_MARKSHEET: import("@apollo/client").DocumentNode;
|
|
193
193
|
/**
|
|
194
194
|
* toggleStrikeOptions
|
|
@@ -2487,8 +2487,8 @@ exports.START_OR_JOIN_MARKSHEET = (0, client_1.gql) `
|
|
|
2487
2487
|
questionChoiceId
|
|
2488
2488
|
marksheetId
|
|
2489
2489
|
timeTaken
|
|
2490
|
-
isAnswered
|
|
2491
2490
|
striked
|
|
2491
|
+
isAnswered
|
|
2492
2492
|
mark
|
|
2493
2493
|
question {
|
|
2494
2494
|
... on QuestionSBA {
|
|
@@ -3063,8 +3063,8 @@ exports.MODIFY_MARKSHEET_INFO = (0, client_1.gql) `
|
|
|
3063
3063
|
questionChoiceId
|
|
3064
3064
|
marksheetId
|
|
3065
3065
|
timeTaken
|
|
3066
|
-
isAnswered
|
|
3067
3066
|
striked
|
|
3067
|
+
isAnswered
|
|
3068
3068
|
mark
|
|
3069
3069
|
question {
|
|
3070
3070
|
... on QuestionSBA {
|
|
@@ -3586,7 +3586,11 @@ exports.LEAVE_MARKSHEET = (0, client_1.gql) `
|
|
|
3586
3586
|
exports.END_MARKSHEET = (0, client_1.gql) `
|
|
3587
3587
|
mutation EndMarksheet($marksheetId: Int!) {
|
|
3588
3588
|
restricted {
|
|
3589
|
-
endMarksheet(marksheetId: $marksheetId)
|
|
3589
|
+
endMarksheet(marksheetId: $marksheetId){
|
|
3590
|
+
id
|
|
3591
|
+
timeTaken
|
|
3592
|
+
endedAt
|
|
3593
|
+
}
|
|
3590
3594
|
}
|
|
3591
3595
|
}
|
|
3592
3596
|
`;
|
|
@@ -3,9 +3,9 @@ export * from './author';
|
|
|
3
3
|
export * from './blog';
|
|
4
4
|
export * from './book';
|
|
5
5
|
export * from './feedback';
|
|
6
|
+
export * from './product';
|
|
6
7
|
export * as restricted from './restricted';
|
|
7
8
|
export * from './sample';
|
|
8
|
-
export * from './subscription';
|
|
9
9
|
export * from './university';
|
|
10
10
|
export * from './user';
|
|
11
11
|
export * from './video';
|
package/resolvers/query/index.js
CHANGED
|
@@ -28,9 +28,9 @@ __exportStar(require("./author"), exports);
|
|
|
28
28
|
__exportStar(require("./blog"), exports);
|
|
29
29
|
__exportStar(require("./book"), exports);
|
|
30
30
|
__exportStar(require("./feedback"), exports);
|
|
31
|
+
__exportStar(require("./product"), exports);
|
|
31
32
|
exports.restricted = __importStar(require("./restricted"));
|
|
32
33
|
__exportStar(require("./sample"), exports);
|
|
33
|
-
__exportStar(require("./subscription"), exports);
|
|
34
34
|
__exportStar(require("./university"), exports);
|
|
35
35
|
__exportStar(require("./user"), exports);
|
|
36
36
|
__exportStar(require("./video"), exports);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PRODUCTS = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
|
-
exports.
|
|
6
|
-
query
|
|
7
|
-
|
|
5
|
+
exports.PRODUCTS = (0, client_1.gql) `
|
|
6
|
+
query Products {
|
|
7
|
+
products {
|
|
8
8
|
id
|
|
9
9
|
createdAt
|
|
10
10
|
description
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ISubscription } from '../../models';
|
|
2
|
-
import { graphqlNormalize, RootData } from '../types';
|
|
3
|
-
export declare type ISubscriptionsData = RootData<(graphqlNormalize & ISubscription)[], 'subscriptions'>;
|
|
4
|
-
export declare const SUBSCRIPTIONS: import("@apollo/client").DocumentNode;
|