@vestcards/server-types 1.0.2 → 1.1.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 +402 -22
- package/dist/apps/server/src/config/env.d.ts +3 -2
- package/dist/apps/server/src/modules/auth/index.d.ts +35 -4
- package/dist/apps/server/src/modules/auth/lib.d.ts +18 -7
- package/dist/apps/server/src/modules/auth/permissions/completed-profile.d.ts +1 -0
- package/dist/apps/server/src/modules/auth/permissions/entitlements.d.ts +1 -1
- package/dist/apps/server/src/modules/auth/permissions/permissions.d.ts +2 -66
- package/dist/apps/server/src/modules/card/index.d.ts +71 -5
- package/dist/apps/server/src/modules/card/model.d.ts +4 -0
- package/dist/apps/server/src/modules/card/service.d.ts +2 -0
- package/dist/apps/server/src/modules/deck/index.d.ts +41 -9
- package/dist/apps/server/src/modules/deck/model.d.ts +5 -3
- package/dist/apps/server/src/modules/library/index.d.ts +55 -5
- package/dist/apps/server/src/modules/library/service.d.ts +4 -0
- package/dist/apps/server/src/modules/study/index.d.ts +87 -8
- package/dist/apps/server/src/modules/study/lib/fsrs.d.ts +1 -1
- package/dist/apps/server/src/modules/study/model.d.ts +7 -1
- package/dist/apps/server/src/modules/study/service.d.ts +22 -1
- package/dist/apps/server/src/modules/topic/index.d.ts +38 -7
- package/dist/apps/server/src/modules/user/index.d.ts +108 -5
- package/dist/apps/server/src/modules/user/model.d.ts +8 -0
- package/dist/apps/server/src/modules/user/service.d.ts +15 -0
- package/dist/apps/server/src/tests/helpers/auth-helpers.d.ts +1 -1
- package/dist/apps/server/src/tests/helpers/fixtures.d.ts +33 -2
- package/dist/apps/server/src/utils/select.d.ts +1 -1
- package/dist/packages/db-core/src/db.d.ts +4 -0
- package/dist/packages/db-core/src/index.d.ts +4 -0
- package/dist/{apps/server/src/db → packages/db-core/src}/schema/auth.d.ts +26 -9
- package/dist/packages/db-core/src/schema/blog.d.ts +219 -0
- package/dist/{apps/server/src/db → packages/db-core/src}/schema/entity.d.ts +2 -2
- package/dist/{apps/server/src/db → packages/db-core/src}/schema/index.d.ts +3 -0
- package/dist/packages/db-core/src/schema/organization.d.ts +158 -0
- package/dist/{apps/server/src/db → packages/db-core/src}/schema/payment.d.ts +18 -1
- package/dist/packages/db-core/src/schema/studyPlan.d.ts +511 -0
- package/dist/{apps/server/src/db → packages/db-core/src}/utils.d.ts +1 -0
- package/dist/packages/db-core/src/views/deck.d.ts +79 -0
- package/dist/packages/shared/src/eden.d.ts +43 -0
- package/dist/packages/shared/src/index.d.ts +1 -0
- package/dist/packages/shared/src/theme/data-colors.d.ts +2 -0
- package/dist/packages/shared/src/theme/index.d.ts +3 -0
- package/dist/packages/shared/src/theme/tokens/border.d.ts +11 -0
- package/dist/packages/shared/src/theme/tokens/colors.d.ts +356 -0
- package/dist/packages/shared/src/theme/utils.d.ts +7 -0
- package/dist/packages/shared/src/types/blog.d.ts +8 -0
- package/dist/packages/shared/src/types/deck.d.ts +2 -1
- package/dist/packages/shared/src/types/fsrs.d.ts +9 -8
- package/dist/packages/shared/src/types/index.d.ts +3 -0
- package/dist/packages/shared/src/types/permissions.d.ts +108 -0
- package/dist/packages/shared/src/types/studyPlan.d.ts +5 -0
- package/dist/packages/shared/src/types/subject.d.ts +19 -2
- package/package.json +1 -1
- package/dist/apps/server/src/db/index.d.ts +0 -6
- package/dist/apps/server/src/db/migrate.d.ts +0 -1
- package/dist/apps/server/src/db/types.d.ts +0 -2
- package/dist/apps/server/src/utils/uuid.d.ts +0 -1
- /package/dist/{apps/server/src/db → packages/db-core/src}/schema/data.d.ts +0 -0
- /package/dist/{apps/server/src/db → packages/db-core/src}/schema/deck.d.ts +0 -0
- /package/dist/{apps/server/src/db → packages/db-core/src}/schema/marketing.d.ts +0 -0
|
@@ -20,7 +20,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
20
20
|
macro: Partial<{
|
|
21
21
|
readonly auth: boolean;
|
|
22
22
|
}> & Partial<{
|
|
23
|
-
readonly permission: import("
|
|
23
|
+
readonly permission: import("@vestcards/shared").Permission | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
macroFn: {
|
|
26
26
|
readonly auth: {
|
|
@@ -42,7 +42,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
42
42
|
route: string;
|
|
43
43
|
request: Request;
|
|
44
44
|
store: {};
|
|
45
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends
|
|
45
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
46
46
|
readonly 100: "Continue";
|
|
47
47
|
readonly 101: "Switching Protocols";
|
|
48
48
|
readonly 102: "Processing";
|
|
@@ -169,6 +169,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
169
169
|
}[Code] : Code>;
|
|
170
170
|
}) => Promise<{
|
|
171
171
|
entitlements: import("@vestcards/shared").Entitlement[];
|
|
172
|
+
completedProfile: boolean;
|
|
172
173
|
user: {
|
|
173
174
|
id: string;
|
|
174
175
|
createdAt: Date;
|
|
@@ -183,6 +184,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
183
184
|
};
|
|
184
185
|
session: {
|
|
185
186
|
entitlements: import("@vestcards/shared").Entitlement[];
|
|
187
|
+
completedProfile: boolean;
|
|
186
188
|
id: string;
|
|
187
189
|
createdAt: Date;
|
|
188
190
|
updatedAt: Date;
|
|
@@ -195,7 +197,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
195
197
|
}>;
|
|
196
198
|
};
|
|
197
199
|
} & {
|
|
198
|
-
readonly permission: (permission?: import("
|
|
200
|
+
readonly permission: (permission?: import("@vestcards/shared").Permission) => {
|
|
199
201
|
readonly resolve: ({ request: { headers } }: {
|
|
200
202
|
body: unknown;
|
|
201
203
|
query: Record<string, string>;
|
|
@@ -214,7 +216,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
214
216
|
route: string;
|
|
215
217
|
request: Request;
|
|
216
218
|
store: {};
|
|
217
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends
|
|
219
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
218
220
|
readonly 100: "Continue";
|
|
219
221
|
readonly 101: "Switching Protocols";
|
|
220
222
|
readonly 102: "Processing";
|
|
@@ -346,7 +348,36 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
346
348
|
response: {};
|
|
347
349
|
}, {
|
|
348
350
|
v1: {
|
|
349
|
-
study: {
|
|
351
|
+
study: {
|
|
352
|
+
v1: {
|
|
353
|
+
auth: {
|
|
354
|
+
"validate-reset-token": {
|
|
355
|
+
get: {
|
|
356
|
+
body: unknown;
|
|
357
|
+
params: {};
|
|
358
|
+
query: {
|
|
359
|
+
token: string;
|
|
360
|
+
};
|
|
361
|
+
headers: unknown;
|
|
362
|
+
response: {
|
|
363
|
+
200: {
|
|
364
|
+
valid: boolean;
|
|
365
|
+
};
|
|
366
|
+
422: {
|
|
367
|
+
type: "validation";
|
|
368
|
+
on: string;
|
|
369
|
+
summary?: string;
|
|
370
|
+
message?: string;
|
|
371
|
+
found?: unknown;
|
|
372
|
+
property?: string;
|
|
373
|
+
expected?: string;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
};
|
|
350
381
|
};
|
|
351
382
|
} & {
|
|
352
383
|
v1: {
|
|
@@ -357,7 +388,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
357
388
|
params: {};
|
|
358
389
|
query: {
|
|
359
390
|
id?: string | undefined;
|
|
360
|
-
type: "
|
|
391
|
+
type: "DECK" | "ALL" | "TOPIC" | "SUBJECT";
|
|
361
392
|
};
|
|
362
393
|
headers: {};
|
|
363
394
|
response: {
|
|
@@ -385,7 +416,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
385
416
|
params: {};
|
|
386
417
|
query: {
|
|
387
418
|
id?: string | undefined;
|
|
388
|
-
type: "
|
|
419
|
+
type: "DECK" | "ALL" | "TOPIC" | "SUBJECT";
|
|
389
420
|
};
|
|
390
421
|
headers: {};
|
|
391
422
|
response: {
|
|
@@ -410,6 +441,54 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
410
441
|
};
|
|
411
442
|
};
|
|
412
443
|
};
|
|
444
|
+
} & {
|
|
445
|
+
v1: {
|
|
446
|
+
study: {
|
|
447
|
+
context: {
|
|
448
|
+
get: {
|
|
449
|
+
body: {};
|
|
450
|
+
params: {};
|
|
451
|
+
query: {
|
|
452
|
+
id?: string | undefined;
|
|
453
|
+
type: "DECK" | "ALL" | "TOPIC" | "SUBJECT";
|
|
454
|
+
};
|
|
455
|
+
headers: {};
|
|
456
|
+
response: {
|
|
457
|
+
200: {
|
|
458
|
+
type: "ALL";
|
|
459
|
+
title: string;
|
|
460
|
+
subtitle: string;
|
|
461
|
+
icon: string;
|
|
462
|
+
} | {
|
|
463
|
+
type: "DECK";
|
|
464
|
+
title: string;
|
|
465
|
+
subtitle: string;
|
|
466
|
+
icon: string;
|
|
467
|
+
} | {
|
|
468
|
+
type: "TOPIC";
|
|
469
|
+
title: string;
|
|
470
|
+
subtitle: string;
|
|
471
|
+
icon: string;
|
|
472
|
+
} | {
|
|
473
|
+
type: "SUBJECT";
|
|
474
|
+
title: string;
|
|
475
|
+
subtitle: string;
|
|
476
|
+
icon: string;
|
|
477
|
+
};
|
|
478
|
+
422: {
|
|
479
|
+
type: "validation";
|
|
480
|
+
on: string;
|
|
481
|
+
summary?: string;
|
|
482
|
+
message?: string;
|
|
483
|
+
found?: unknown;
|
|
484
|
+
property?: string;
|
|
485
|
+
expected?: string;
|
|
486
|
+
};
|
|
487
|
+
};
|
|
488
|
+
};
|
|
489
|
+
};
|
|
490
|
+
};
|
|
491
|
+
};
|
|
413
492
|
} & {
|
|
414
493
|
v1: {
|
|
415
494
|
study: {
|
|
@@ -418,7 +497,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
418
497
|
body: {
|
|
419
498
|
cardId: string;
|
|
420
499
|
userDeckStudyId: string;
|
|
421
|
-
grade: "Again" | "Hard" | "Good" | "Easy";
|
|
500
|
+
grade: "Manual" | "Again" | "Hard" | "Good" | "Easy";
|
|
422
501
|
reviewDurationInSeconds: number;
|
|
423
502
|
};
|
|
424
503
|
params: {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CardReview, type NewCardReview, type NewReviewLog, type Rating } from '@vestcards
|
|
1
|
+
import { type CardReview, type NewCardReview, type NewReviewLog, type Rating } from '@vestcards/db-core';
|
|
2
2
|
import { type Card as FSRSCard } from 'ts-fsrs';
|
|
3
3
|
export declare const gradeCard: (card: CardReview, schemaRating: Rating, durationInSeconds: number) => {
|
|
4
4
|
nextCard: CardReview;
|
|
@@ -7,7 +7,13 @@ export declare namespace StudyModel {
|
|
|
7
7
|
const gradeCardBody: import("@sinclair/typebox").TObject<{
|
|
8
8
|
cardId: import("@sinclair/typebox").TString;
|
|
9
9
|
userDeckStudyId: import("@sinclair/typebox").TString;
|
|
10
|
-
grade: import("@sinclair/typebox").
|
|
10
|
+
grade: import("@sinclair/typebox").TEnum<{
|
|
11
|
+
readonly Manual: "Manual";
|
|
12
|
+
readonly Again: "Again";
|
|
13
|
+
readonly Hard: "Hard";
|
|
14
|
+
readonly Good: "Good";
|
|
15
|
+
readonly Easy: "Easy";
|
|
16
|
+
}>;
|
|
11
17
|
reviewDurationInSeconds: import("@sinclair/typebox").TNumber;
|
|
12
18
|
}>;
|
|
13
19
|
type GradeCardBody = typeof gradeCardBody.static;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type CardReview } from '@vestcards/db-core';
|
|
1
2
|
import type { ISessionData, IStudyStats, StudyType } from '@vestcards/shared';
|
|
2
|
-
import { type CardReview } from '../../db/schema/deck';
|
|
3
3
|
import type { StudyModel } from './model';
|
|
4
4
|
export declare abstract class StudyService {
|
|
5
5
|
static getSessionData(userId: string, type: StudyType, id?: string): Promise<ISessionData>;
|
|
@@ -17,4 +17,25 @@ export declare abstract class StudyService {
|
|
|
17
17
|
}>;
|
|
18
18
|
static getCardReview(userId: string, cardId: string): Promise<CardReview>;
|
|
19
19
|
static gradeCard(userId: string, input: StudyModel.GradeCardBody): Promise<void>;
|
|
20
|
+
static getStudyContext(userId: string, type: StudyType, id?: string): Promise<{
|
|
21
|
+
type: "ALL";
|
|
22
|
+
title: string;
|
|
23
|
+
subtitle: string;
|
|
24
|
+
icon: string;
|
|
25
|
+
} | {
|
|
26
|
+
type: "DECK";
|
|
27
|
+
title: string;
|
|
28
|
+
subtitle: string;
|
|
29
|
+
icon: string;
|
|
30
|
+
} | {
|
|
31
|
+
type: "TOPIC";
|
|
32
|
+
title: string;
|
|
33
|
+
subtitle: string;
|
|
34
|
+
icon: string;
|
|
35
|
+
} | {
|
|
36
|
+
type: "SUBJECT";
|
|
37
|
+
title: string;
|
|
38
|
+
subtitle: string;
|
|
39
|
+
icon: string;
|
|
40
|
+
}>;
|
|
20
41
|
}
|
|
@@ -20,7 +20,7 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
20
20
|
macro: Partial<{
|
|
21
21
|
readonly auth: boolean;
|
|
22
22
|
}> & Partial<{
|
|
23
|
-
readonly permission: import("
|
|
23
|
+
readonly permission: import("@vestcards/shared").Permission | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
macroFn: {
|
|
26
26
|
readonly auth: {
|
|
@@ -42,7 +42,7 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
42
42
|
route: string;
|
|
43
43
|
request: Request;
|
|
44
44
|
store: {};
|
|
45
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends
|
|
45
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
46
46
|
readonly 100: "Continue";
|
|
47
47
|
readonly 101: "Switching Protocols";
|
|
48
48
|
readonly 102: "Processing";
|
|
@@ -169,6 +169,7 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
169
169
|
}[Code] : Code>;
|
|
170
170
|
}) => Promise<{
|
|
171
171
|
entitlements: import("@vestcards/shared").Entitlement[];
|
|
172
|
+
completedProfile: boolean;
|
|
172
173
|
user: {
|
|
173
174
|
id: string;
|
|
174
175
|
createdAt: Date;
|
|
@@ -183,6 +184,7 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
183
184
|
};
|
|
184
185
|
session: {
|
|
185
186
|
entitlements: import("@vestcards/shared").Entitlement[];
|
|
187
|
+
completedProfile: boolean;
|
|
186
188
|
id: string;
|
|
187
189
|
createdAt: Date;
|
|
188
190
|
updatedAt: Date;
|
|
@@ -195,7 +197,7 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
195
197
|
}>;
|
|
196
198
|
};
|
|
197
199
|
} & {
|
|
198
|
-
readonly permission: (permission?: import("
|
|
200
|
+
readonly permission: (permission?: import("@vestcards/shared").Permission) => {
|
|
199
201
|
readonly resolve: ({ request: { headers } }: {
|
|
200
202
|
body: unknown;
|
|
201
203
|
query: Record<string, string>;
|
|
@@ -214,7 +216,7 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
214
216
|
route: string;
|
|
215
217
|
request: Request;
|
|
216
218
|
store: {};
|
|
217
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends
|
|
219
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
218
220
|
readonly 100: "Continue";
|
|
219
221
|
readonly 101: "Switching Protocols";
|
|
220
222
|
readonly 102: "Processing";
|
|
@@ -346,13 +348,42 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
346
348
|
response: {};
|
|
347
349
|
}, {
|
|
348
350
|
v1: {
|
|
349
|
-
topics: {
|
|
351
|
+
topics: {
|
|
352
|
+
v1: {
|
|
353
|
+
auth: {
|
|
354
|
+
"validate-reset-token": {
|
|
355
|
+
get: {
|
|
356
|
+
body: unknown;
|
|
357
|
+
params: {};
|
|
358
|
+
query: {
|
|
359
|
+
token: string;
|
|
360
|
+
};
|
|
361
|
+
headers: unknown;
|
|
362
|
+
response: {
|
|
363
|
+
200: {
|
|
364
|
+
valid: boolean;
|
|
365
|
+
};
|
|
366
|
+
422: {
|
|
367
|
+
type: "validation";
|
|
368
|
+
on: string;
|
|
369
|
+
summary?: string;
|
|
370
|
+
message?: string;
|
|
371
|
+
found?: unknown;
|
|
372
|
+
property?: string;
|
|
373
|
+
expected?: string;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
};
|
|
350
381
|
};
|
|
351
382
|
} & {
|
|
352
383
|
v1: {
|
|
353
384
|
topics: {
|
|
354
385
|
get: {
|
|
355
|
-
body:
|
|
386
|
+
body: {};
|
|
356
387
|
params: {};
|
|
357
388
|
query: {
|
|
358
389
|
sort?: string | undefined;
|
|
@@ -362,7 +393,7 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
362
393
|
size: number;
|
|
363
394
|
page: number;
|
|
364
395
|
};
|
|
365
|
-
headers:
|
|
396
|
+
headers: {};
|
|
366
397
|
response: {
|
|
367
398
|
200: {
|
|
368
399
|
data: import("@vestcards/shared").Topic[];
|
|
@@ -20,7 +20,7 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
20
20
|
macro: Partial<{
|
|
21
21
|
readonly auth: boolean;
|
|
22
22
|
}> & Partial<{
|
|
23
|
-
readonly permission: import("
|
|
23
|
+
readonly permission: import("@vestcards/shared").Permission | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
macroFn: {
|
|
26
26
|
readonly auth: {
|
|
@@ -42,7 +42,7 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
42
42
|
route: string;
|
|
43
43
|
request: Request;
|
|
44
44
|
store: {};
|
|
45
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends
|
|
45
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
46
46
|
readonly 100: "Continue";
|
|
47
47
|
readonly 101: "Switching Protocols";
|
|
48
48
|
readonly 102: "Processing";
|
|
@@ -169,6 +169,7 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
169
169
|
}[Code] : Code>;
|
|
170
170
|
}) => Promise<{
|
|
171
171
|
entitlements: import("@vestcards/shared").Entitlement[];
|
|
172
|
+
completedProfile: boolean;
|
|
172
173
|
user: {
|
|
173
174
|
id: string;
|
|
174
175
|
createdAt: Date;
|
|
@@ -183,6 +184,7 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
183
184
|
};
|
|
184
185
|
session: {
|
|
185
186
|
entitlements: import("@vestcards/shared").Entitlement[];
|
|
187
|
+
completedProfile: boolean;
|
|
186
188
|
id: string;
|
|
187
189
|
createdAt: Date;
|
|
188
190
|
updatedAt: Date;
|
|
@@ -195,7 +197,7 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
195
197
|
}>;
|
|
196
198
|
};
|
|
197
199
|
} & {
|
|
198
|
-
readonly permission: (permission?: import("
|
|
200
|
+
readonly permission: (permission?: import("@vestcards/shared").Permission) => {
|
|
199
201
|
readonly resolve: ({ request: { headers } }: {
|
|
200
202
|
body: unknown;
|
|
201
203
|
query: Record<string, string>;
|
|
@@ -214,7 +216,7 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
214
216
|
route: string;
|
|
215
217
|
request: Request;
|
|
216
218
|
store: {};
|
|
217
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends
|
|
219
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
218
220
|
readonly 100: "Continue";
|
|
219
221
|
readonly 101: "Switching Protocols";
|
|
220
222
|
readonly 102: "Processing";
|
|
@@ -346,7 +348,36 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
346
348
|
response: {};
|
|
347
349
|
}, {
|
|
348
350
|
v1: {
|
|
349
|
-
user: {
|
|
351
|
+
user: {
|
|
352
|
+
v1: {
|
|
353
|
+
auth: {
|
|
354
|
+
"validate-reset-token": {
|
|
355
|
+
get: {
|
|
356
|
+
body: unknown;
|
|
357
|
+
params: {};
|
|
358
|
+
query: {
|
|
359
|
+
token: string;
|
|
360
|
+
};
|
|
361
|
+
headers: unknown;
|
|
362
|
+
response: {
|
|
363
|
+
200: {
|
|
364
|
+
valid: boolean;
|
|
365
|
+
};
|
|
366
|
+
422: {
|
|
367
|
+
type: "validation";
|
|
368
|
+
on: string;
|
|
369
|
+
summary?: string;
|
|
370
|
+
message?: string;
|
|
371
|
+
found?: unknown;
|
|
372
|
+
property?: string;
|
|
373
|
+
expected?: string;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
};
|
|
350
381
|
};
|
|
351
382
|
} & {
|
|
352
383
|
v1: {
|
|
@@ -365,6 +396,7 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
365
396
|
email: string;
|
|
366
397
|
image: string | null;
|
|
367
398
|
role: import("@vestcards/shared").UserRole;
|
|
399
|
+
goal: string | null;
|
|
368
400
|
learnDailyLimit: number | null;
|
|
369
401
|
universityId: number | null;
|
|
370
402
|
universityName: string | null;
|
|
@@ -407,6 +439,77 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
407
439
|
};
|
|
408
440
|
};
|
|
409
441
|
};
|
|
442
|
+
} & {
|
|
443
|
+
v1: {
|
|
444
|
+
user: {
|
|
445
|
+
account: {
|
|
446
|
+
delete: {
|
|
447
|
+
body: {};
|
|
448
|
+
params: {};
|
|
449
|
+
query: {};
|
|
450
|
+
headers: {};
|
|
451
|
+
response: {
|
|
452
|
+
200: {
|
|
453
|
+
success: boolean;
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
} & {
|
|
461
|
+
v1: {
|
|
462
|
+
user: {
|
|
463
|
+
membership: {
|
|
464
|
+
get: {
|
|
465
|
+
body: {};
|
|
466
|
+
params: {};
|
|
467
|
+
query: {};
|
|
468
|
+
headers: {};
|
|
469
|
+
response: {
|
|
470
|
+
200: {
|
|
471
|
+
status: import("@vestcards/shared").MembershipStatus;
|
|
472
|
+
expiresAt: Date | null;
|
|
473
|
+
} | null;
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
} & {
|
|
480
|
+
v1: {
|
|
481
|
+
user: {
|
|
482
|
+
"complete-profile": {
|
|
483
|
+
post: {
|
|
484
|
+
body: {
|
|
485
|
+
dayTimeReminder?: string | undefined;
|
|
486
|
+
university?: number | undefined;
|
|
487
|
+
course?: number | undefined;
|
|
488
|
+
goal: string;
|
|
489
|
+
hoursStudied: string;
|
|
490
|
+
referral: string;
|
|
491
|
+
};
|
|
492
|
+
params: {};
|
|
493
|
+
query: {};
|
|
494
|
+
headers: {};
|
|
495
|
+
response: {
|
|
496
|
+
200: {
|
|
497
|
+
success: boolean;
|
|
498
|
+
};
|
|
499
|
+
422: {
|
|
500
|
+
type: "validation";
|
|
501
|
+
on: string;
|
|
502
|
+
summary?: string;
|
|
503
|
+
message?: string;
|
|
504
|
+
found?: unknown;
|
|
505
|
+
property?: string;
|
|
506
|
+
expected?: string;
|
|
507
|
+
};
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
};
|
|
410
513
|
}, {
|
|
411
514
|
derive: {};
|
|
412
515
|
resolve: {};
|
|
@@ -20,4 +20,12 @@ export declare namespace UserModel {
|
|
|
20
20
|
university: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TNull]>>;
|
|
21
21
|
course: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TNull]>>;
|
|
22
22
|
}>;
|
|
23
|
+
const completeProfileBody: import("@sinclair/typebox").TObject<{
|
|
24
|
+
goal: import("@sinclair/typebox").TString;
|
|
25
|
+
hoursStudied: import("@sinclair/typebox").TString;
|
|
26
|
+
referral: import("@sinclair/typebox").TString;
|
|
27
|
+
university: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
28
|
+
course: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
29
|
+
dayTimeReminder: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
30
|
+
}>;
|
|
23
31
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MembershipStatus } from '@vestcards/shared';
|
|
1
2
|
export declare abstract class UserService {
|
|
2
3
|
static getLearnDailyLimit(userId: string): Promise<number>;
|
|
3
4
|
static getProfile(userId: string): Promise<{
|
|
@@ -7,12 +8,26 @@ export declare abstract class UserService {
|
|
|
7
8
|
email: string;
|
|
8
9
|
image: string | null;
|
|
9
10
|
role: import("@vestcards/shared").UserRole;
|
|
11
|
+
goal: string | null;
|
|
10
12
|
learnDailyLimit: number | null;
|
|
11
13
|
universityId: number | null;
|
|
12
14
|
universityName: string | null;
|
|
13
15
|
courseId: number | null;
|
|
14
16
|
courseName: string | null;
|
|
15
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>;
|
|
26
|
+
static deleteAccount(userId: string): Promise<void>;
|
|
27
|
+
static getMembership(userId: string): Promise<{
|
|
28
|
+
status: MembershipStatus;
|
|
29
|
+
expiresAt: Date | null;
|
|
30
|
+
} | null>;
|
|
16
31
|
static upsertSettings(userId: string, data: {
|
|
17
32
|
learnDailyLimit?: number;
|
|
18
33
|
university?: number | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MembershipStatus } from '@vestcards/shared';
|
|
1
2
|
/**
|
|
2
3
|
* Create a test topic
|
|
3
4
|
*/
|
|
@@ -28,12 +29,12 @@ export declare function createDeck(data: {
|
|
|
28
29
|
id: string;
|
|
29
30
|
createdAt: Date;
|
|
30
31
|
updatedAt: Date;
|
|
32
|
+
deletedAt: Date | null;
|
|
31
33
|
description: string;
|
|
32
34
|
title: string;
|
|
33
35
|
topicId: string;
|
|
34
36
|
keywords: string[];
|
|
35
37
|
free: boolean;
|
|
36
|
-
deletedAt: Date | null;
|
|
37
38
|
ownerId: string;
|
|
38
39
|
lastEditedBy: string | null;
|
|
39
40
|
}>;
|
|
@@ -85,12 +86,12 @@ export declare function createTestDeck(data: {
|
|
|
85
86
|
id: string;
|
|
86
87
|
createdAt: Date;
|
|
87
88
|
updatedAt: Date;
|
|
89
|
+
deletedAt: Date | null;
|
|
88
90
|
description: string;
|
|
89
91
|
title: string;
|
|
90
92
|
topicId: string;
|
|
91
93
|
keywords: string[];
|
|
92
94
|
free: boolean;
|
|
93
|
-
deletedAt: Date | null;
|
|
94
95
|
ownerId: string;
|
|
95
96
|
lastEditedBy: string | null;
|
|
96
97
|
}>;
|
|
@@ -157,3 +158,33 @@ export declare function createOfficialEntity(): Promise<{
|
|
|
157
158
|
* Delete an official entity (user deleted via cascade on entity)
|
|
158
159
|
*/
|
|
159
160
|
export declare function deleteOfficialEntity(entityId: string): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Create a membership for a given entity.
|
|
163
|
+
* Ensures the shared test plan exists before inserting.
|
|
164
|
+
*/
|
|
165
|
+
export declare function createMembership(data: {
|
|
166
|
+
entityId: string;
|
|
167
|
+
status?: MembershipStatus;
|
|
168
|
+
startedAt?: Date;
|
|
169
|
+
expiresAt?: Date;
|
|
170
|
+
}): Promise<{
|
|
171
|
+
status: MembershipStatus;
|
|
172
|
+
value: number;
|
|
173
|
+
id: string;
|
|
174
|
+
entityId: string;
|
|
175
|
+
createdAt: Date;
|
|
176
|
+
updatedAt: Date;
|
|
177
|
+
expiresAt: Date | null;
|
|
178
|
+
planId: string;
|
|
179
|
+
asaasPaymentId: string;
|
|
180
|
+
asaasInstallmentId: string | null;
|
|
181
|
+
installmentCount: number;
|
|
182
|
+
billingType: import("@vestcards/shared").BillingType;
|
|
183
|
+
couponCode: string | null;
|
|
184
|
+
idempotencyKey: string | null;
|
|
185
|
+
startedAt: Date | null;
|
|
186
|
+
}>;
|
|
187
|
+
/**
|
|
188
|
+
* Delete a membership by ID
|
|
189
|
+
*/
|
|
190
|
+
export declare function deleteMembership(membershipId: string): Promise<void>;
|