@vestcards/server-types 0.4.0 → 1.0.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 +128 -4
- package/dist/apps/server/src/db/migrate.d.ts +1 -0
- package/dist/apps/server/src/db/schema/auth.d.ts +13 -13
- package/dist/apps/server/src/db/schema/deck.d.ts +1 -1
- package/dist/apps/server/src/modules/data/data.test.d.ts +1 -0
- package/dist/apps/server/src/modules/data/index.d.ts +94 -0
- package/dist/apps/server/src/modules/library/index.d.ts +2 -2
- package/dist/apps/server/src/modules/library/service.d.ts +3 -3
- package/dist/apps/server/src/modules/study/index.d.ts +2 -2
- package/dist/apps/server/src/modules/study/service.d.ts +5 -5
- package/dist/apps/server/src/modules/study/utils.d.ts +3 -4
- package/dist/apps/server/src/modules/topic/service.d.ts +1 -1
- package/dist/apps/server/src/modules/user/index.d.ts +59 -0
- package/dist/apps/server/src/modules/user/model.d.ts +7 -0
- package/dist/apps/server/src/modules/user/service.d.ts +18 -0
- package/dist/apps/server/src/modules/user/user.test.d.ts +1 -0
- package/dist/apps/server/src/utils/select.d.ts +2 -2
- package/dist/packages/shared/src/index.d.ts +1 -0
- package/dist/packages/shared/src/types/fsrs.d.ts +17 -0
- package/dist/packages/shared/src/types/study.d.ts +49 -15
- package/package.json +1 -1
- package/dist/apps/server/src/types/study.d.ts +0 -28
- package/dist/apps/server/src/types/topic.d.ts +0 -1
|
@@ -530,7 +530,7 @@ declare const app: Elysia<"", {
|
|
|
530
530
|
};
|
|
531
531
|
headers: {};
|
|
532
532
|
response: {
|
|
533
|
-
200: import("
|
|
533
|
+
200: import("@vestcards/shared").ISessionData;
|
|
534
534
|
422: {
|
|
535
535
|
type: "validation";
|
|
536
536
|
on: string;
|
|
@@ -558,7 +558,7 @@ declare const app: Elysia<"", {
|
|
|
558
558
|
};
|
|
559
559
|
headers: {};
|
|
560
560
|
response: {
|
|
561
|
-
200: import("@vestcards/shared").
|
|
561
|
+
200: import("@vestcards/shared").IStudyStats | {
|
|
562
562
|
status: import("@vestcards/shared").StudyStatus;
|
|
563
563
|
review: number;
|
|
564
564
|
learning: number;
|
|
@@ -624,7 +624,7 @@ declare const app: Elysia<"", {
|
|
|
624
624
|
query: {};
|
|
625
625
|
headers: {};
|
|
626
626
|
response: {
|
|
627
|
-
200: import("@vestcards/shared").
|
|
627
|
+
200: import("@vestcards/shared").IGroupedLibraryData;
|
|
628
628
|
};
|
|
629
629
|
};
|
|
630
630
|
};
|
|
@@ -639,7 +639,7 @@ declare const app: Elysia<"", {
|
|
|
639
639
|
query: {};
|
|
640
640
|
headers: {};
|
|
641
641
|
response: {
|
|
642
|
-
200: import("@vestcards/shared").
|
|
642
|
+
200: import("@vestcards/shared").IArchivedLibraryItem[];
|
|
643
643
|
};
|
|
644
644
|
};
|
|
645
645
|
};
|
|
@@ -774,6 +774,130 @@ declare const app: Elysia<"", {
|
|
|
774
774
|
};
|
|
775
775
|
};
|
|
776
776
|
};
|
|
777
|
+
} & {
|
|
778
|
+
v1: {
|
|
779
|
+
user: {};
|
|
780
|
+
};
|
|
781
|
+
} & {
|
|
782
|
+
v1: {
|
|
783
|
+
user: {
|
|
784
|
+
me: {
|
|
785
|
+
get: {
|
|
786
|
+
body: {};
|
|
787
|
+
params: {};
|
|
788
|
+
query: {};
|
|
789
|
+
headers: {};
|
|
790
|
+
response: {
|
|
791
|
+
200: {
|
|
792
|
+
id: string;
|
|
793
|
+
name: string;
|
|
794
|
+
surname: string;
|
|
795
|
+
email: string;
|
|
796
|
+
image: string | null;
|
|
797
|
+
role: import("@vestcards/shared").UserRole;
|
|
798
|
+
learnDailyLimit: number | null;
|
|
799
|
+
universityId: number | null;
|
|
800
|
+
universityName: string | null;
|
|
801
|
+
courseId: number | null;
|
|
802
|
+
courseName: string | null;
|
|
803
|
+
};
|
|
804
|
+
};
|
|
805
|
+
};
|
|
806
|
+
};
|
|
807
|
+
};
|
|
808
|
+
};
|
|
809
|
+
} & {
|
|
810
|
+
v1: {
|
|
811
|
+
user: {
|
|
812
|
+
settings: {
|
|
813
|
+
patch: {
|
|
814
|
+
body: {
|
|
815
|
+
university?: number | null | undefined;
|
|
816
|
+
course?: number | null | undefined;
|
|
817
|
+
learnDailyLimit?: number | undefined;
|
|
818
|
+
};
|
|
819
|
+
params: {};
|
|
820
|
+
query: {};
|
|
821
|
+
headers: {};
|
|
822
|
+
response: {
|
|
823
|
+
200: {
|
|
824
|
+
success: boolean;
|
|
825
|
+
};
|
|
826
|
+
422: {
|
|
827
|
+
type: "validation";
|
|
828
|
+
on: string;
|
|
829
|
+
summary?: string;
|
|
830
|
+
message?: string;
|
|
831
|
+
found?: unknown;
|
|
832
|
+
property?: string;
|
|
833
|
+
expected?: string;
|
|
834
|
+
};
|
|
835
|
+
};
|
|
836
|
+
};
|
|
837
|
+
};
|
|
838
|
+
};
|
|
839
|
+
};
|
|
840
|
+
} & {
|
|
841
|
+
v1: {
|
|
842
|
+
data: {
|
|
843
|
+
universities: {
|
|
844
|
+
get: {
|
|
845
|
+
body: unknown;
|
|
846
|
+
params: {};
|
|
847
|
+
query: {
|
|
848
|
+
q?: string | undefined;
|
|
849
|
+
};
|
|
850
|
+
headers: unknown;
|
|
851
|
+
response: {
|
|
852
|
+
200: {
|
|
853
|
+
id: number;
|
|
854
|
+
name: string;
|
|
855
|
+
acronym: string;
|
|
856
|
+
}[];
|
|
857
|
+
422: {
|
|
858
|
+
type: "validation";
|
|
859
|
+
on: string;
|
|
860
|
+
summary?: string;
|
|
861
|
+
message?: string;
|
|
862
|
+
found?: unknown;
|
|
863
|
+
property?: string;
|
|
864
|
+
expected?: string;
|
|
865
|
+
};
|
|
866
|
+
};
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
};
|
|
870
|
+
};
|
|
871
|
+
} & {
|
|
872
|
+
v1: {
|
|
873
|
+
data: {
|
|
874
|
+
courses: {
|
|
875
|
+
get: {
|
|
876
|
+
body: unknown;
|
|
877
|
+
params: {};
|
|
878
|
+
query: {
|
|
879
|
+
q?: string | undefined;
|
|
880
|
+
};
|
|
881
|
+
headers: unknown;
|
|
882
|
+
response: {
|
|
883
|
+
200: {
|
|
884
|
+
id: number;
|
|
885
|
+
name: string;
|
|
886
|
+
}[];
|
|
887
|
+
422: {
|
|
888
|
+
type: "validation";
|
|
889
|
+
on: string;
|
|
890
|
+
summary?: string;
|
|
891
|
+
message?: string;
|
|
892
|
+
found?: unknown;
|
|
893
|
+
property?: string;
|
|
894
|
+
expected?: string;
|
|
895
|
+
};
|
|
896
|
+
};
|
|
897
|
+
};
|
|
898
|
+
};
|
|
899
|
+
};
|
|
900
|
+
};
|
|
777
901
|
} & {
|
|
778
902
|
health: {
|
|
779
903
|
get: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -659,13 +659,13 @@ export declare const verification: import("drizzle-orm/pg-core").PgTableWithColu
|
|
|
659
659
|
};
|
|
660
660
|
dialect: "pg";
|
|
661
661
|
}>;
|
|
662
|
-
export declare const
|
|
663
|
-
name: "
|
|
662
|
+
export declare const userSettings: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
663
|
+
name: "user_settings";
|
|
664
664
|
schema: undefined;
|
|
665
665
|
columns: {
|
|
666
666
|
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
667
667
|
name: "userId";
|
|
668
|
-
tableName: "
|
|
668
|
+
tableName: "user_settings";
|
|
669
669
|
dataType: "string";
|
|
670
670
|
columnType: "PgText";
|
|
671
671
|
data: string;
|
|
@@ -682,7 +682,7 @@ export declare const userAdditionalData: import("drizzle-orm/pg-core").PgTableWi
|
|
|
682
682
|
}, {}, {}>;
|
|
683
683
|
goal: import("drizzle-orm/pg-core").PgColumn<{
|
|
684
684
|
name: "goal";
|
|
685
|
-
tableName: "
|
|
685
|
+
tableName: "user_settings";
|
|
686
686
|
dataType: "string";
|
|
687
687
|
columnType: "PgText";
|
|
688
688
|
data: string;
|
|
@@ -699,7 +699,7 @@ export declare const userAdditionalData: import("drizzle-orm/pg-core").PgTableWi
|
|
|
699
699
|
}, {}, {}>;
|
|
700
700
|
hoursStudied: import("drizzle-orm/pg-core").PgColumn<{
|
|
701
701
|
name: "hours_studied";
|
|
702
|
-
tableName: "
|
|
702
|
+
tableName: "user_settings";
|
|
703
703
|
dataType: "string";
|
|
704
704
|
columnType: "PgText";
|
|
705
705
|
data: string;
|
|
@@ -716,7 +716,7 @@ export declare const userAdditionalData: import("drizzle-orm/pg-core").PgTableWi
|
|
|
716
716
|
}, {}, {}>;
|
|
717
717
|
dayTimeReminder: import("drizzle-orm/pg-core").PgColumn<{
|
|
718
718
|
name: "day_time_reminder";
|
|
719
|
-
tableName: "
|
|
719
|
+
tableName: "user_settings";
|
|
720
720
|
dataType: "string";
|
|
721
721
|
columnType: "PgText";
|
|
722
722
|
data: string;
|
|
@@ -733,7 +733,7 @@ export declare const userAdditionalData: import("drizzle-orm/pg-core").PgTableWi
|
|
|
733
733
|
}, {}, {}>;
|
|
734
734
|
referral: import("drizzle-orm/pg-core").PgColumn<{
|
|
735
735
|
name: "referral";
|
|
736
|
-
tableName: "
|
|
736
|
+
tableName: "user_settings";
|
|
737
737
|
dataType: "string";
|
|
738
738
|
columnType: "PgText";
|
|
739
739
|
data: string;
|
|
@@ -750,7 +750,7 @@ export declare const userAdditionalData: import("drizzle-orm/pg-core").PgTableWi
|
|
|
750
750
|
}, {}, {}>;
|
|
751
751
|
university: import("drizzle-orm/pg-core").PgColumn<{
|
|
752
752
|
name: "university";
|
|
753
|
-
tableName: "
|
|
753
|
+
tableName: "user_settings";
|
|
754
754
|
dataType: "number";
|
|
755
755
|
columnType: "PgInteger";
|
|
756
756
|
data: number;
|
|
@@ -767,7 +767,7 @@ export declare const userAdditionalData: import("drizzle-orm/pg-core").PgTableWi
|
|
|
767
767
|
}, {}, {}>;
|
|
768
768
|
course: import("drizzle-orm/pg-core").PgColumn<{
|
|
769
769
|
name: "course";
|
|
770
|
-
tableName: "
|
|
770
|
+
tableName: "user_settings";
|
|
771
771
|
dataType: "number";
|
|
772
772
|
columnType: "PgInteger";
|
|
773
773
|
data: number;
|
|
@@ -784,7 +784,7 @@ export declare const userAdditionalData: import("drizzle-orm/pg-core").PgTableWi
|
|
|
784
784
|
}, {}, {}>;
|
|
785
785
|
learnDailyLimit: import("drizzle-orm/pg-core").PgColumn<{
|
|
786
786
|
name: "learn_daily_limit";
|
|
787
|
-
tableName: "
|
|
787
|
+
tableName: "user_settings";
|
|
788
788
|
dataType: "number";
|
|
789
789
|
columnType: "PgInteger";
|
|
790
790
|
data: number;
|
|
@@ -801,7 +801,7 @@ export declare const userAdditionalData: import("drizzle-orm/pg-core").PgTableWi
|
|
|
801
801
|
}, {}, {}>;
|
|
802
802
|
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
803
803
|
name: "created_at";
|
|
804
|
-
tableName: "
|
|
804
|
+
tableName: "user_settings";
|
|
805
805
|
dataType: "date";
|
|
806
806
|
columnType: "PgTimestamp";
|
|
807
807
|
data: Date;
|
|
@@ -833,9 +833,9 @@ export type User = InferSelectModel<typeof user>;
|
|
|
833
833
|
export type Session = InferSelectModel<typeof session>;
|
|
834
834
|
export type Account = InferSelectModel<typeof account>;
|
|
835
835
|
export type Verification = InferSelectModel<typeof verification>;
|
|
836
|
-
export type
|
|
836
|
+
export type UserSettings = InferSelectModel<typeof userSettings>;
|
|
837
837
|
export type NewUser = InferInsertModel<typeof user>;
|
|
838
838
|
export type NewSession = InferInsertModel<typeof session>;
|
|
839
839
|
export type NewAccount = InferInsertModel<typeof account>;
|
|
840
840
|
export type NewVerification = InferInsertModel<typeof verification>;
|
|
841
|
-
export type
|
|
841
|
+
export type NewUserSettings = InferInsertModel<typeof userSettings>;
|
|
@@ -1019,7 +1019,7 @@ export declare const reviewLogs: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
1019
1019
|
tableName: "review_log";
|
|
1020
1020
|
dataType: "string";
|
|
1021
1021
|
columnType: "PgText";
|
|
1022
|
-
data: "
|
|
1022
|
+
data: "Manual" | "Again" | "Hard" | "Good" | "Easy";
|
|
1023
1023
|
driverParam: string;
|
|
1024
1024
|
notNull: true;
|
|
1025
1025
|
hasDefault: false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
export declare const dataModule: Elysia<"/v1/data", {
|
|
3
|
+
decorator: {};
|
|
4
|
+
store: {};
|
|
5
|
+
derive: {};
|
|
6
|
+
resolve: {};
|
|
7
|
+
}, {
|
|
8
|
+
typebox: {};
|
|
9
|
+
error: {};
|
|
10
|
+
}, {
|
|
11
|
+
schema: {};
|
|
12
|
+
standaloneSchema: {};
|
|
13
|
+
macro: {};
|
|
14
|
+
macroFn: {};
|
|
15
|
+
parser: {};
|
|
16
|
+
response: {};
|
|
17
|
+
}, {
|
|
18
|
+
v1: {
|
|
19
|
+
data: {
|
|
20
|
+
universities: {
|
|
21
|
+
get: {
|
|
22
|
+
body: unknown;
|
|
23
|
+
params: {};
|
|
24
|
+
query: {
|
|
25
|
+
q?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
headers: unknown;
|
|
28
|
+
response: {
|
|
29
|
+
200: {
|
|
30
|
+
id: number;
|
|
31
|
+
name: string;
|
|
32
|
+
acronym: string;
|
|
33
|
+
}[];
|
|
34
|
+
422: {
|
|
35
|
+
type: "validation";
|
|
36
|
+
on: string;
|
|
37
|
+
summary?: string;
|
|
38
|
+
message?: string;
|
|
39
|
+
found?: unknown;
|
|
40
|
+
property?: string;
|
|
41
|
+
expected?: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
} & {
|
|
49
|
+
v1: {
|
|
50
|
+
data: {
|
|
51
|
+
courses: {
|
|
52
|
+
get: {
|
|
53
|
+
body: unknown;
|
|
54
|
+
params: {};
|
|
55
|
+
query: {
|
|
56
|
+
q?: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
headers: unknown;
|
|
59
|
+
response: {
|
|
60
|
+
200: {
|
|
61
|
+
id: number;
|
|
62
|
+
name: string;
|
|
63
|
+
}[];
|
|
64
|
+
422: {
|
|
65
|
+
type: "validation";
|
|
66
|
+
on: string;
|
|
67
|
+
summary?: string;
|
|
68
|
+
message?: string;
|
|
69
|
+
found?: unknown;
|
|
70
|
+
property?: string;
|
|
71
|
+
expected?: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}, {
|
|
79
|
+
derive: {};
|
|
80
|
+
resolve: {};
|
|
81
|
+
schema: {};
|
|
82
|
+
standaloneSchema: {};
|
|
83
|
+
response: {};
|
|
84
|
+
}, {
|
|
85
|
+
derive: {};
|
|
86
|
+
resolve: {};
|
|
87
|
+
schema: {};
|
|
88
|
+
standaloneSchema: {};
|
|
89
|
+
response: {
|
|
90
|
+
[x: string]: {
|
|
91
|
+
[x: string]: any;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
@@ -357,7 +357,7 @@ export declare const libraryModule: Elysia<"/v1/library", {
|
|
|
357
357
|
query: {};
|
|
358
358
|
headers: {};
|
|
359
359
|
response: {
|
|
360
|
-
200: import("@vestcards/shared").
|
|
360
|
+
200: import("@vestcards/shared").IGroupedLibraryData;
|
|
361
361
|
};
|
|
362
362
|
};
|
|
363
363
|
};
|
|
@@ -372,7 +372,7 @@ export declare const libraryModule: Elysia<"/v1/library", {
|
|
|
372
372
|
query: {};
|
|
373
373
|
headers: {};
|
|
374
374
|
response: {
|
|
375
|
-
200: import("@vestcards/shared").
|
|
375
|
+
200: import("@vestcards/shared").IArchivedLibraryItem[];
|
|
376
376
|
};
|
|
377
377
|
};
|
|
378
378
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IArchivedLibraryItem, IGroupedLibraryData } from '@vestcards/shared';
|
|
2
2
|
export declare abstract class LibraryService {
|
|
3
|
-
static getGroupedLibraryData(userId: string): Promise<
|
|
4
|
-
static getArchivedLibraryData(userId: string): Promise<
|
|
3
|
+
static getGroupedLibraryData(userId: string): Promise<IGroupedLibraryData>;
|
|
4
|
+
static getArchivedLibraryData(userId: string): Promise<IArchivedLibraryItem[]>;
|
|
5
5
|
static startDeckStudy(userId: string, deckId: string): Promise<void>;
|
|
6
6
|
static deleteDeckStudy(userId: string, deckId: string): Promise<void>;
|
|
7
7
|
static updateDeckStudySuspended(userId: string, deckId: string, suspended: boolean): Promise<void>;
|
|
@@ -361,7 +361,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
361
361
|
};
|
|
362
362
|
headers: {};
|
|
363
363
|
response: {
|
|
364
|
-
200: import("
|
|
364
|
+
200: import("@vestcards/shared").ISessionData;
|
|
365
365
|
422: {
|
|
366
366
|
type: "validation";
|
|
367
367
|
on: string;
|
|
@@ -389,7 +389,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
389
389
|
};
|
|
390
390
|
headers: {};
|
|
391
391
|
response: {
|
|
392
|
-
200: import("@vestcards/shared").
|
|
392
|
+
200: import("@vestcards/shared").IStudyStats | {
|
|
393
393
|
status: import("@vestcards/shared").StudyStatus;
|
|
394
394
|
review: number;
|
|
395
395
|
learning: number;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import type { ISessionData, IStudyStats, StudyType } from '@vestcards/shared';
|
|
1
2
|
import { type CardReview } from '../../db/schema/deck';
|
|
2
|
-
import type { SessionData, SessionStats, StudyType } from '../../types/study';
|
|
3
3
|
import type { StudyModel } from './model';
|
|
4
4
|
export declare abstract class StudyService {
|
|
5
|
-
static getSessionData(userId: string, type: StudyType, id?: string): Promise<
|
|
5
|
+
static getSessionData(userId: string, type: StudyType, id?: string): Promise<ISessionData>;
|
|
6
6
|
static getNumberLeftToLearnToday(userId: string, date?: Date): Promise<number>;
|
|
7
7
|
static getStats(userId: string, numLeftToLearn: number, // capacity left today (from the function above)
|
|
8
|
-
type: StudyType, id?: string): Promise<
|
|
9
|
-
static getReviewCards(userId: string, type: StudyType, id?: string, maxToFetch?: number): Promise<import("
|
|
10
|
-
static getNewCards(userId: string, allocatedNewForToday: number, type: StudyType, id?: string): Promise<import("
|
|
8
|
+
type: StudyType, id?: string): Promise<IStudyStats>;
|
|
9
|
+
static getReviewCards(userId: string, type: StudyType, id?: string, maxToFetch?: number): Promise<import("@vestcards/shared").ISessionCard[]>;
|
|
10
|
+
static getNewCards(userId: string, allocatedNewForToday: number, type: StudyType, id?: string): Promise<import("@vestcards/shared").ISessionCard[]>;
|
|
11
11
|
static getUserDeckStudy(userId: string, deckId: string): Promise<{
|
|
12
12
|
suspended: boolean;
|
|
13
13
|
id: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { SessionCard, StudyType } from 'src/types/study';
|
|
1
|
+
import type { ISessionCard, IStudyStats, StudyStatus, StudyType } from '@vestcards/shared';
|
|
3
2
|
import type { SessionCardSelect } from 'src/utils/select';
|
|
4
3
|
export declare const getSessionFilterByStudyType: (type: StudyType, id?: string) => import("drizzle-orm").SQL<unknown> | undefined;
|
|
5
4
|
export declare const allocateByPriority: (capacityLeft: number, counts: {
|
|
@@ -12,7 +11,7 @@ export declare const allocateByPriority: (capacityLeft: number, counts: {
|
|
|
12
11
|
new: number;
|
|
13
12
|
total: number;
|
|
14
13
|
};
|
|
15
|
-
export declare function getStudyStatus(stats:
|
|
14
|
+
export declare function getStudyStatus(stats: IStudyStats, userDeckStudy: {
|
|
16
15
|
suspended: boolean;
|
|
17
16
|
} | undefined): StudyStatus;
|
|
18
|
-
export declare function sessionCardToICard(sessionRows: SessionCardSelect[]):
|
|
17
|
+
export declare function sessionCardToICard(sessionRows: SessionCardSelect[]): ISessionCard[];
|
|
@@ -348,6 +348,65 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
348
348
|
v1: {
|
|
349
349
|
user: {};
|
|
350
350
|
};
|
|
351
|
+
} & {
|
|
352
|
+
v1: {
|
|
353
|
+
user: {
|
|
354
|
+
me: {
|
|
355
|
+
get: {
|
|
356
|
+
body: {};
|
|
357
|
+
params: {};
|
|
358
|
+
query: {};
|
|
359
|
+
headers: {};
|
|
360
|
+
response: {
|
|
361
|
+
200: {
|
|
362
|
+
id: string;
|
|
363
|
+
name: string;
|
|
364
|
+
surname: string;
|
|
365
|
+
email: string;
|
|
366
|
+
image: string | null;
|
|
367
|
+
role: import("@vestcards/shared").UserRole;
|
|
368
|
+
learnDailyLimit: number | null;
|
|
369
|
+
universityId: number | null;
|
|
370
|
+
universityName: string | null;
|
|
371
|
+
courseId: number | null;
|
|
372
|
+
courseName: string | null;
|
|
373
|
+
};
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
} & {
|
|
380
|
+
v1: {
|
|
381
|
+
user: {
|
|
382
|
+
settings: {
|
|
383
|
+
patch: {
|
|
384
|
+
body: {
|
|
385
|
+
university?: number | null | undefined;
|
|
386
|
+
course?: number | null | undefined;
|
|
387
|
+
learnDailyLimit?: number | undefined;
|
|
388
|
+
};
|
|
389
|
+
params: {};
|
|
390
|
+
query: {};
|
|
391
|
+
headers: {};
|
|
392
|
+
response: {
|
|
393
|
+
200: {
|
|
394
|
+
success: boolean;
|
|
395
|
+
};
|
|
396
|
+
422: {
|
|
397
|
+
type: "validation";
|
|
398
|
+
on: string;
|
|
399
|
+
summary?: string;
|
|
400
|
+
message?: string;
|
|
401
|
+
found?: unknown;
|
|
402
|
+
property?: string;
|
|
403
|
+
expected?: string;
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
};
|
|
351
410
|
}, {
|
|
352
411
|
derive: {};
|
|
353
412
|
resolve: {};
|
|
@@ -14,3 +14,10 @@ export declare namespace TopicModel {
|
|
|
14
14
|
subjects?: Subject[];
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
export declare namespace UserModel {
|
|
18
|
+
const updateSettingsBody: import("@sinclair/typebox").TObject<{
|
|
19
|
+
learnDailyLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
20
|
+
university: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TNull]>>;
|
|
21
|
+
course: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TNull]>>;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
export declare abstract class UserService {
|
|
2
2
|
static getLearnDailyLimit(userId: string): Promise<number>;
|
|
3
|
+
static getProfile(userId: string): Promise<{
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
surname: string;
|
|
7
|
+
email: string;
|
|
8
|
+
image: string | null;
|
|
9
|
+
role: import("@vestcards/shared").UserRole;
|
|
10
|
+
learnDailyLimit: number | null;
|
|
11
|
+
universityId: number | null;
|
|
12
|
+
universityName: string | null;
|
|
13
|
+
courseId: number | null;
|
|
14
|
+
courseName: string | null;
|
|
15
|
+
}>;
|
|
16
|
+
static upsertSettings(userId: string, data: {
|
|
17
|
+
learnDailyLimit?: number;
|
|
18
|
+
university?: number | null;
|
|
19
|
+
course?: number | null;
|
|
20
|
+
}): Promise<void>;
|
|
3
21
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Subject } from '@vestcards/shared';
|
|
2
|
-
import {
|
|
2
|
+
import type { CardReview } from '../db/schema/deck';
|
|
3
3
|
export declare const sessionCardSelect: {
|
|
4
4
|
card: {
|
|
5
5
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
@@ -364,7 +364,7 @@ export type SessionCardSelect = {
|
|
|
364
364
|
subject: Subject;
|
|
365
365
|
topicName: string;
|
|
366
366
|
userDeckStudyId: string;
|
|
367
|
-
cardReview:
|
|
367
|
+
cardReview: Omit<CardReview, 'cardId' | 'userDeckStudyId'> | null;
|
|
368
368
|
};
|
|
369
369
|
export declare const statsSelect: {
|
|
370
370
|
new: import("drizzle-orm").SQL<number>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum ReviewState {
|
|
2
|
+
New = "New",
|
|
3
|
+
Learning = "Learning",
|
|
4
|
+
Review = "Review",
|
|
5
|
+
Relearning = "Relearning"
|
|
6
|
+
}
|
|
7
|
+
export declare const reviewStates: readonly ["New", "Learning", "Review", "Relearning"];
|
|
8
|
+
export type ReviewStateType = keyof typeof ReviewState;
|
|
9
|
+
export declare enum ReviewRating {
|
|
10
|
+
Manual = "Manual",
|
|
11
|
+
Again = "Again",
|
|
12
|
+
Hard = "Hard",
|
|
13
|
+
Good = "Good",
|
|
14
|
+
Easy = "Easy"
|
|
15
|
+
}
|
|
16
|
+
export declare const reviewRatings: readonly ["Manual", "Again", "Hard", "Good", "Easy"];
|
|
17
|
+
export type ReviewRatingType = keyof typeof ReviewRating;
|
|
@@ -1,29 +1,63 @@
|
|
|
1
|
+
import type { ICard, Subject } from './deck';
|
|
2
|
+
import type { ReviewRating, ReviewState } from './fsrs';
|
|
1
3
|
export type StudyType = 'ALL' | 'DECK' | 'TOPIC' | 'SUBJECT';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
export interface ICardReview {
|
|
5
|
+
id: string;
|
|
6
|
+
due: Date | null;
|
|
7
|
+
stability: number;
|
|
8
|
+
difficulty: number;
|
|
9
|
+
elapsedDays: number;
|
|
10
|
+
scheduledDays: number;
|
|
11
|
+
reps: number;
|
|
12
|
+
lapses: number;
|
|
13
|
+
state: ReviewState;
|
|
14
|
+
lastReview: Date | null;
|
|
15
|
+
userDeckStudyId: string;
|
|
16
|
+
cardId: string;
|
|
17
|
+
}
|
|
18
|
+
export interface IReviewLog {
|
|
19
|
+
id: number;
|
|
20
|
+
cardReviewId: string;
|
|
21
|
+
grade: ReviewRating;
|
|
22
|
+
state: ReviewState;
|
|
23
|
+
due: Date;
|
|
24
|
+
stability: number;
|
|
25
|
+
difficulty: number;
|
|
26
|
+
elapsedDays: number;
|
|
27
|
+
lastElapsedDays: number;
|
|
28
|
+
scheduledDays: number;
|
|
29
|
+
review: Date;
|
|
30
|
+
duration: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ISessionCard {
|
|
33
|
+
card: ICard;
|
|
34
|
+
cardReview: ICardReview;
|
|
35
|
+
subject: Subject;
|
|
36
|
+
topicName: string;
|
|
37
|
+
userDeckStudyId: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ISessionData {
|
|
40
|
+
reviewCards: ISessionCard[];
|
|
41
|
+
newCards: ISessionCard[];
|
|
42
|
+
stats: IStudyStats;
|
|
43
|
+
}
|
|
44
|
+
export interface IStudyStats {
|
|
5
45
|
review: number;
|
|
6
46
|
learning: number;
|
|
7
47
|
new: number;
|
|
8
48
|
total: number;
|
|
9
49
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
userDeckStudyId: string;
|
|
13
|
-
grade: Rating;
|
|
14
|
-
reviewDurationInSeconds: number;
|
|
15
|
-
}
|
|
16
|
-
export interface GroupedLibraryItem {
|
|
50
|
+
export type StudyStatus = 'not-started' | 'suspended' | 'has-cards' | 'no-cards';
|
|
51
|
+
export interface IGroupedLibraryItem {
|
|
17
52
|
name: string;
|
|
18
53
|
id: string;
|
|
19
54
|
ownerId?: string;
|
|
20
55
|
type: StudyType;
|
|
21
|
-
stats:
|
|
22
|
-
subRows?:
|
|
56
|
+
stats: IStudyStats;
|
|
57
|
+
subRows?: IGroupedLibraryItem[];
|
|
23
58
|
}
|
|
24
|
-
export type
|
|
25
|
-
export
|
|
26
|
-
export interface ArchivedLibraryItem {
|
|
59
|
+
export type IGroupedLibraryData = IGroupedLibraryItem[];
|
|
60
|
+
export interface IArchivedLibraryItem {
|
|
27
61
|
deckId: string;
|
|
28
62
|
subject: string;
|
|
29
63
|
topic: string;
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Subject } from '@vestcards/shared';
|
|
2
|
-
import type { CardReview } from 'src/db/schema/deck';
|
|
3
|
-
export type { CardState, GradeCardInput, Rating, SessionStats, StudyStatus, StudyType } from '@vestcards/shared';
|
|
4
|
-
export interface ICard {
|
|
5
|
-
id: string;
|
|
6
|
-
question: string;
|
|
7
|
-
answer: string | null;
|
|
8
|
-
frontImage?: {
|
|
9
|
-
id: string;
|
|
10
|
-
url: string;
|
|
11
|
-
};
|
|
12
|
-
backImage?: {
|
|
13
|
-
id: string;
|
|
14
|
-
url: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export type SessionCard = {
|
|
18
|
-
card: ICard;
|
|
19
|
-
card_review: CardReview;
|
|
20
|
-
subject: Subject;
|
|
21
|
-
topicName: string;
|
|
22
|
-
userDeckStudyId: string;
|
|
23
|
-
};
|
|
24
|
-
export interface SessionData {
|
|
25
|
-
reviewCards: SessionCard[];
|
|
26
|
-
newCards: SessionCard[];
|
|
27
|
-
stats: import('@vestcards/shared').SessionStats;
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { Topic } from '@vestcards/shared';
|