@vestcards/server-types 1.0.2 → 1.2.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 +401 -21
- package/dist/apps/server/src/config/env.d.ts +1 -0
- package/dist/apps/server/src/modules/auth/index.d.ts +33 -2
- package/dist/apps/server/src/modules/auth/lib.d.ts +65 -5
- 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/auth/utils.d.ts +1 -0
- package/dist/apps/server/src/modules/card/index.d.ts +70 -4
- 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 +39 -7
- package/dist/apps/server/src/modules/deck/model.d.ts +5 -3
- package/dist/apps/server/src/modules/library/index.d.ts +53 -3
- package/dist/apps/server/src/modules/library/service.d.ts +4 -0
- package/dist/apps/server/src/modules/study/index.d.ts +85 -6
- 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 +36 -5
- package/dist/apps/server/src/modules/user/index.d.ts +106 -3
- 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 +112 -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: {
|
|
@@ -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>;
|
|
@@ -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: {
|
|
@@ -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>;
|
|
@@ -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: {
|
|
@@ -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>;
|
|
@@ -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
|
+
university?: number | undefined;
|
|
486
|
+
dayTimeReminder?: string | 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>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { UserRole } from '@vestcards/shared';
|
|
1
2
|
import type { InferInsertModel, InferSelectModel } from 'drizzle-orm';
|
|
2
|
-
import { UserRole } from '../types';
|
|
3
3
|
export declare const user: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
4
|
name: "user";
|
|
5
5
|
schema: undefined;
|
|
@@ -12,10 +12,10 @@ export declare const user: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
12
12
|
data: string;
|
|
13
13
|
driverParam: string;
|
|
14
14
|
notNull: true;
|
|
15
|
-
hasDefault:
|
|
15
|
+
hasDefault: true;
|
|
16
16
|
isPrimaryKey: true;
|
|
17
17
|
isAutoincrement: false;
|
|
18
|
-
hasRuntimeDefault:
|
|
18
|
+
hasRuntimeDefault: true;
|
|
19
19
|
enumValues: [string, ...string[]];
|
|
20
20
|
baseColumn: never;
|
|
21
21
|
identity: undefined;
|
|
@@ -176,6 +176,23 @@ export declare const user: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
176
176
|
identity: undefined;
|
|
177
177
|
generated: undefined;
|
|
178
178
|
}, {}, {}>;
|
|
179
|
+
deletedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
180
|
+
name: "deleted_at";
|
|
181
|
+
tableName: "user";
|
|
182
|
+
dataType: "date";
|
|
183
|
+
columnType: "PgTimestamp";
|
|
184
|
+
data: Date;
|
|
185
|
+
driverParam: string;
|
|
186
|
+
notNull: false;
|
|
187
|
+
hasDefault: false;
|
|
188
|
+
isPrimaryKey: false;
|
|
189
|
+
isAutoincrement: false;
|
|
190
|
+
hasRuntimeDefault: false;
|
|
191
|
+
enumValues: undefined;
|
|
192
|
+
baseColumn: never;
|
|
193
|
+
identity: undefined;
|
|
194
|
+
generated: undefined;
|
|
195
|
+
}, {}, {}>;
|
|
179
196
|
};
|
|
180
197
|
dialect: "pg";
|
|
181
198
|
}>;
|
|
@@ -191,10 +208,10 @@ export declare const session: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
191
208
|
data: string;
|
|
192
209
|
driverParam: string;
|
|
193
210
|
notNull: true;
|
|
194
|
-
hasDefault:
|
|
211
|
+
hasDefault: true;
|
|
195
212
|
isPrimaryKey: true;
|
|
196
213
|
isAutoincrement: false;
|
|
197
|
-
hasRuntimeDefault:
|
|
214
|
+
hasRuntimeDefault: true;
|
|
198
215
|
enumValues: [string, ...string[]];
|
|
199
216
|
baseColumn: never;
|
|
200
217
|
identity: undefined;
|
|
@@ -334,10 +351,10 @@ export declare const account: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
334
351
|
data: string;
|
|
335
352
|
driverParam: string;
|
|
336
353
|
notNull: true;
|
|
337
|
-
hasDefault:
|
|
354
|
+
hasDefault: true;
|
|
338
355
|
isPrimaryKey: true;
|
|
339
356
|
isAutoincrement: false;
|
|
340
|
-
hasRuntimeDefault:
|
|
357
|
+
hasRuntimeDefault: true;
|
|
341
358
|
enumValues: [string, ...string[]];
|
|
342
359
|
baseColumn: never;
|
|
343
360
|
identity: undefined;
|
|
@@ -562,10 +579,10 @@ export declare const verification: import("drizzle-orm/pg-core").PgTableWithColu
|
|
|
562
579
|
data: string;
|
|
563
580
|
driverParam: string;
|
|
564
581
|
notNull: true;
|
|
565
|
-
hasDefault:
|
|
582
|
+
hasDefault: true;
|
|
566
583
|
isPrimaryKey: true;
|
|
567
584
|
isAutoincrement: false;
|
|
568
|
-
hasRuntimeDefault:
|
|
585
|
+
hasRuntimeDefault: true;
|
|
569
586
|
enumValues: [string, ...string[]];
|
|
570
587
|
baseColumn: never;
|
|
571
588
|
identity: undefined;
|