@vestcards/server-types 1.2.0 → 1.4.0
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/apps/server/src/app.d.ts +437 -16
- package/dist/apps/server/src/config/env.d.ts +7 -1
- package/dist/apps/server/src/lib/metrics.d.ts +4 -0
- package/dist/apps/server/src/lib/posthog.d.ts +2 -0
- package/dist/apps/server/src/libs/mappers.d.ts +5 -0
- package/dist/apps/server/src/middleware/errorHandler.d.ts +1 -1
- package/dist/apps/server/src/middleware/logger.d.ts +12 -29
- package/dist/apps/server/src/modules/auth/lib.d.ts +45 -17
- package/dist/apps/server/src/modules/auth/profile.d.ts +5 -0
- package/dist/apps/server/src/modules/auth/utils.d.ts +1 -0
- package/dist/apps/server/src/modules/card/index.d.ts +89 -0
- package/dist/apps/server/src/modules/card/model.d.ts +17 -0
- package/dist/apps/server/src/modules/card/service.d.ts +8 -1
- package/dist/apps/server/src/modules/cron/cron.test.d.ts +1 -0
- package/dist/apps/server/src/modules/cron/index.d.ts +53 -0
- package/dist/apps/server/src/modules/cron/jobs/expire-memberships.d.ts +1 -0
- package/dist/apps/server/src/modules/cron/jobs/payment-expiry-reminder.d.ts +1 -0
- package/dist/apps/server/src/modules/deck/index.d.ts +19 -1
- package/dist/apps/server/src/modules/deck/model.d.ts +4 -0
- package/dist/apps/server/src/modules/deck/service.d.ts +5 -1
- package/dist/apps/server/src/modules/ranking/index.d.ts +412 -0
- package/dist/apps/server/src/modules/ranking/model.d.ts +28 -0
- package/dist/apps/server/src/modules/ranking/ranking.test.d.ts +1 -0
- package/dist/apps/server/src/modules/ranking/service.d.ts +4 -0
- package/dist/apps/server/src/modules/stats/index.d.ts +446 -0
- package/dist/apps/server/src/modules/stats/model.d.ts +85 -0
- package/dist/apps/server/src/modules/stats/service.d.ts +27 -0
- package/dist/apps/server/src/modules/stats/stats.test.d.ts +1 -0
- package/dist/apps/server/src/modules/study/service.d.ts +7 -7
- package/dist/apps/server/src/modules/user/errors.d.ts +3 -0
- package/dist/apps/server/src/modules/user/index.d.ts +94 -15
- package/dist/apps/server/src/modules/user/model.d.ts +17 -1
- package/dist/apps/server/src/modules/user/service.d.ts +17 -29
- package/dist/apps/server/src/modules/vesty/index.d.ts +473 -0
- package/dist/apps/server/src/modules/vesty/model.d.ts +35 -0
- package/dist/apps/server/src/modules/vesty/service.d.ts +6 -0
- package/dist/apps/server/src/modules/vesty/services/generate-deck.d.ts +2 -0
- package/dist/apps/server/src/modules/vesty/services/insights.d.ts +3 -0
- package/dist/apps/server/src/modules/vesty/tools.d.ts +11 -0
- package/dist/apps/server/src/modules/vesty/utils.d.ts +69 -0
- package/dist/apps/server/src/modules/vesty/vesty.test.d.ts +1 -0
- package/dist/apps/server/src/server.d.ts +1 -0
- package/dist/apps/server/src/tests/helpers/fixtures.d.ts +9 -6
- package/dist/apps/server/src/tests/preload/vesty-mock.d.ts +1 -0
- package/dist/apps/server/src/utils/api.d.ts +1 -1
- package/dist/apps/server/src/utils/select.d.ts +17 -0
- package/dist/packages/db-core/src/index.d.ts +0 -1
- package/dist/packages/db-core/src/schema/auth.d.ts +94 -0
- package/dist/packages/db-core/src/schema/deck.d.ts +17 -0
- package/dist/packages/db-core/src/schema/payment.d.ts +37 -1
- package/dist/packages/email-core/src/templates/deleteAccountRequest.d.ts +8 -0
- package/dist/packages/email-core/src/templates/footer.d.ts +1 -1
- package/dist/packages/email-core/src/templates/index.d.ts +4 -0
- package/dist/packages/email-core/src/templates/paymentExpiryReminder.d.ts +9 -0
- package/dist/packages/shared/src/date/index.d.ts +1 -0
- package/dist/packages/shared/src/date/timezone.d.ts +29 -0
- package/dist/packages/shared/src/spaced-repetition/config.d.ts +20 -0
- package/dist/packages/shared/src/spaced-repetition/fsrs.d.ts +13 -0
- package/dist/packages/shared/src/spaced-repetition/index.d.ts +5 -0
- package/dist/packages/shared/src/spaced-repetition/retention.d.ts +2 -0
- package/dist/packages/shared/src/spaced-repetition/session-manager.d.ts +25 -0
- package/dist/packages/shared/src/spaced-repetition/utils.d.ts +26 -0
- package/dist/packages/shared/src/theme/tokens/border.d.ts +1 -1
- package/dist/packages/shared/src/theme/tokens/colors.d.ts +18 -18
- package/dist/packages/shared/src/types/deck.d.ts +10 -0
- package/dist/packages/shared/src/types/index.d.ts +1 -0
- package/dist/packages/shared/src/types/permissions.d.ts +2 -0
- package/dist/packages/shared/src/types/user.d.ts +20 -0
- package/dist/packages/shared/src/types/vesty.d.ts +7 -0
- package/dist/packages/utils/src/logger/index.d.ts +2 -1
- package/dist/packages/utils/src/logger/posthog.d.ts +20 -0
- package/package.json +1 -1
- package/dist/apps/server/src/modules/study/lib/constants.d.ts +0 -5
- package/dist/apps/server/src/modules/study/lib/fsrs.d.ts +0 -12
- package/dist/packages/db-core/src/views/deck.d.ts +0 -79
|
@@ -389,20 +389,7 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
389
389
|
query: {};
|
|
390
390
|
headers: {};
|
|
391
391
|
response: {
|
|
392
|
-
200:
|
|
393
|
-
id: string;
|
|
394
|
-
name: string;
|
|
395
|
-
surname: string;
|
|
396
|
-
email: string;
|
|
397
|
-
image: string | null;
|
|
398
|
-
role: import("@vestcards/shared").UserRole;
|
|
399
|
-
goal: string | null;
|
|
400
|
-
learnDailyLimit: number | null;
|
|
401
|
-
universityId: number | null;
|
|
402
|
-
universityName: string | null;
|
|
403
|
-
courseId: number | null;
|
|
404
|
-
courseName: string | null;
|
|
405
|
-
};
|
|
392
|
+
200: import("@vestcards/shared").IUserProfile | null;
|
|
406
393
|
};
|
|
407
394
|
};
|
|
408
395
|
};
|
|
@@ -415,8 +402,10 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
415
402
|
patch: {
|
|
416
403
|
body: {
|
|
417
404
|
university?: number | null | undefined;
|
|
405
|
+
timezone?: string | undefined;
|
|
418
406
|
course?: number | null | undefined;
|
|
419
|
-
learnDailyLimit?: number | undefined;
|
|
407
|
+
learnDailyLimit?: number | null | undefined;
|
|
408
|
+
newCardsPerDeckDailyLimit?: number | null | undefined;
|
|
420
409
|
};
|
|
421
410
|
params: {};
|
|
422
411
|
query: {};
|
|
@@ -457,6 +446,68 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
457
446
|
};
|
|
458
447
|
};
|
|
459
448
|
};
|
|
449
|
+
} & {
|
|
450
|
+
v1: {
|
|
451
|
+
user: {
|
|
452
|
+
account: {
|
|
453
|
+
"delete-request": {
|
|
454
|
+
post: {
|
|
455
|
+
body: {
|
|
456
|
+
email: string;
|
|
457
|
+
};
|
|
458
|
+
params: {};
|
|
459
|
+
query: {};
|
|
460
|
+
headers: {};
|
|
461
|
+
response: {
|
|
462
|
+
200: {
|
|
463
|
+
success: boolean;
|
|
464
|
+
};
|
|
465
|
+
422: {
|
|
466
|
+
type: "validation";
|
|
467
|
+
on: string;
|
|
468
|
+
summary?: string;
|
|
469
|
+
message?: string;
|
|
470
|
+
found?: unknown;
|
|
471
|
+
property?: string;
|
|
472
|
+
expected?: string;
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
} & {
|
|
481
|
+
v1: {
|
|
482
|
+
user: {
|
|
483
|
+
account: {
|
|
484
|
+
"confirm-delete": {
|
|
485
|
+
post: {
|
|
486
|
+
body: {
|
|
487
|
+
token: string;
|
|
488
|
+
};
|
|
489
|
+
params: {};
|
|
490
|
+
query: {};
|
|
491
|
+
headers: {};
|
|
492
|
+
response: {
|
|
493
|
+
200: {
|
|
494
|
+
success: boolean;
|
|
495
|
+
};
|
|
496
|
+
422: {
|
|
497
|
+
type: "validation";
|
|
498
|
+
on: string;
|
|
499
|
+
summary?: string;
|
|
500
|
+
message?: string;
|
|
501
|
+
found?: unknown;
|
|
502
|
+
property?: string;
|
|
503
|
+
expected?: string;
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
};
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
};
|
|
460
511
|
} & {
|
|
461
512
|
v1: {
|
|
462
513
|
user: {
|
|
@@ -476,6 +527,33 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
476
527
|
};
|
|
477
528
|
};
|
|
478
529
|
};
|
|
530
|
+
} & {
|
|
531
|
+
v1: {
|
|
532
|
+
user: {
|
|
533
|
+
password: {
|
|
534
|
+
post: {
|
|
535
|
+
body: {
|
|
536
|
+
newPassword: string;
|
|
537
|
+
currentPassword: string;
|
|
538
|
+
};
|
|
539
|
+
params: {};
|
|
540
|
+
query: {};
|
|
541
|
+
headers: {};
|
|
542
|
+
response: {
|
|
543
|
+
422: {
|
|
544
|
+
type: "validation";
|
|
545
|
+
on: string;
|
|
546
|
+
summary?: string;
|
|
547
|
+
message?: string;
|
|
548
|
+
found?: unknown;
|
|
549
|
+
property?: string;
|
|
550
|
+
expected?: string;
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
};
|
|
479
557
|
} & {
|
|
480
558
|
v1: {
|
|
481
559
|
user: {
|
|
@@ -484,6 +562,7 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
484
562
|
body: {
|
|
485
563
|
university?: number | undefined;
|
|
486
564
|
dayTimeReminder?: string | undefined;
|
|
565
|
+
timezone?: string | undefined;
|
|
487
566
|
course?: number | undefined;
|
|
488
567
|
goal: string;
|
|
489
568
|
hoursStudied: string;
|
|
@@ -15,11 +15,25 @@ export declare namespace TopicModel {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
export declare namespace UserModel {
|
|
18
|
+
const deleteRequestBody: import("@sinclair/typebox").TObject<{
|
|
19
|
+
email: import("@sinclair/typebox").TString;
|
|
20
|
+
}>;
|
|
21
|
+
const confirmDeleteBody: import("@sinclair/typebox").TObject<{
|
|
22
|
+
token: import("@sinclair/typebox").TString;
|
|
23
|
+
}>;
|
|
24
|
+
const updatePasswordBody: import("@sinclair/typebox").TObject<{
|
|
25
|
+
currentPassword: import("@sinclair/typebox").TString;
|
|
26
|
+
newPassword: import("@sinclair/typebox").TString;
|
|
27
|
+
}>;
|
|
28
|
+
type UpdatePasswordBody = typeof updatePasswordBody.static;
|
|
18
29
|
const updateSettingsBody: import("@sinclair/typebox").TObject<{
|
|
19
|
-
learnDailyLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger
|
|
30
|
+
learnDailyLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TNull]>>;
|
|
31
|
+
newCardsPerDeckDailyLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TNull]>>;
|
|
20
32
|
university: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TNull]>>;
|
|
21
33
|
course: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TNull]>>;
|
|
34
|
+
timezone: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
22
35
|
}>;
|
|
36
|
+
type UpdateSettingsBody = typeof updateSettingsBody.static;
|
|
23
37
|
const completeProfileBody: import("@sinclair/typebox").TObject<{
|
|
24
38
|
goal: import("@sinclair/typebox").TString;
|
|
25
39
|
hoursStudied: import("@sinclair/typebox").TString;
|
|
@@ -27,5 +41,7 @@ export declare namespace UserModel {
|
|
|
27
41
|
university: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
28
42
|
course: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
29
43
|
dayTimeReminder: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
44
|
+
timezone: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
30
45
|
}>;
|
|
46
|
+
type CompleteProfileBody = typeof completeProfileBody.static;
|
|
31
47
|
}
|
|
@@ -1,36 +1,24 @@
|
|
|
1
|
-
import { MembershipStatus } from '@vestcards/shared';
|
|
1
|
+
import { type IUserProfile, MembershipStatus } from '@vestcards/shared';
|
|
2
|
+
import type { UserModel } from './model';
|
|
3
|
+
export interface LearningSettings {
|
|
4
|
+
learnDailyLimit: number | null;
|
|
5
|
+
newCardsPerDeckDailyLimit: number | null;
|
|
6
|
+
}
|
|
2
7
|
export declare abstract class UserService {
|
|
3
|
-
static
|
|
4
|
-
static
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
role: import("@vestcards/shared").UserRole;
|
|
11
|
-
goal: string | null;
|
|
12
|
-
learnDailyLimit: number | null;
|
|
13
|
-
universityId: number | null;
|
|
14
|
-
universityName: string | null;
|
|
15
|
-
courseId: number | null;
|
|
16
|
-
courseName: string | null;
|
|
17
|
-
}>;
|
|
18
|
-
static completeProfile(userId: string, data: {
|
|
19
|
-
goal: string;
|
|
20
|
-
hoursStudied: string;
|
|
21
|
-
referral: string;
|
|
22
|
-
university?: number;
|
|
23
|
-
course?: number;
|
|
24
|
-
dayTimeReminder?: string;
|
|
25
|
-
}): Promise<void>;
|
|
8
|
+
private static getUserById;
|
|
9
|
+
static getLearnDailyLimit(userId: string): Promise<number | null>;
|
|
10
|
+
static getLearningSettings(userId: string): Promise<LearningSettings>;
|
|
11
|
+
static getUserTimezone(userId: string): Promise<string>;
|
|
12
|
+
static getProfile(userId: string): Promise<IUserProfile | null>;
|
|
13
|
+
static completeProfile(userId: string, data: UserModel.CompleteProfileBody): Promise<void>;
|
|
14
|
+
private static sendDeletionEmail;
|
|
26
15
|
static deleteAccount(userId: string): Promise<void>;
|
|
16
|
+
static requestDeletion(email: string): Promise<void>;
|
|
17
|
+
static confirmDeletion(token: string): Promise<void>;
|
|
18
|
+
static updatePassword(userId: string, data: UserModel.UpdatePasswordBody): Promise<void>;
|
|
27
19
|
static getMembership(userId: string): Promise<{
|
|
28
20
|
status: MembershipStatus;
|
|
29
21
|
expiresAt: Date | null;
|
|
30
22
|
} | null>;
|
|
31
|
-
static upsertSettings(userId: string, data:
|
|
32
|
-
learnDailyLimit?: number;
|
|
33
|
-
university?: number | null;
|
|
34
|
-
course?: number | null;
|
|
35
|
-
}): Promise<void>;
|
|
23
|
+
static upsertSettings(userId: string, data: UserModel.UpdateSettingsBody): Promise<void>;
|
|
36
24
|
}
|