@vestcards/server-types 1.0.1 → 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.
Files changed (60) hide show
  1. package/dist/apps/server/src/app.d.ts +403 -22
  2. package/dist/apps/server/src/config/env.d.ts +3 -2
  3. package/dist/apps/server/src/modules/auth/index.d.ts +35 -4
  4. package/dist/apps/server/src/modules/auth/lib.d.ts +18 -7
  5. package/dist/apps/server/src/modules/auth/permissions/completed-profile.d.ts +1 -0
  6. package/dist/apps/server/src/modules/auth/permissions/entitlements.d.ts +1 -1
  7. package/dist/apps/server/src/modules/auth/permissions/permissions.d.ts +2 -65
  8. package/dist/apps/server/src/modules/card/index.d.ts +71 -5
  9. package/dist/apps/server/src/modules/card/model.d.ts +4 -0
  10. package/dist/apps/server/src/modules/card/service.d.ts +2 -0
  11. package/dist/apps/server/src/modules/deck/index.d.ts +42 -9
  12. package/dist/apps/server/src/modules/deck/model.d.ts +9 -4
  13. package/dist/apps/server/src/modules/deck/service.d.ts +4 -3
  14. package/dist/apps/server/src/modules/library/index.d.ts +55 -5
  15. package/dist/apps/server/src/modules/library/service.d.ts +4 -0
  16. package/dist/apps/server/src/modules/study/index.d.ts +87 -8
  17. package/dist/apps/server/src/modules/study/lib/fsrs.d.ts +1 -1
  18. package/dist/apps/server/src/modules/study/model.d.ts +7 -1
  19. package/dist/apps/server/src/modules/study/service.d.ts +22 -1
  20. package/dist/apps/server/src/modules/topic/index.d.ts +38 -7
  21. package/dist/apps/server/src/modules/user/index.d.ts +108 -5
  22. package/dist/apps/server/src/modules/user/model.d.ts +8 -0
  23. package/dist/apps/server/src/modules/user/service.d.ts +15 -0
  24. package/dist/apps/server/src/tests/helpers/auth-helpers.d.ts +1 -1
  25. package/dist/apps/server/src/tests/helpers/fixtures.d.ts +44 -2
  26. package/dist/apps/server/src/utils/select.d.ts +1 -1
  27. package/dist/packages/db-core/src/db.d.ts +4 -0
  28. package/dist/packages/db-core/src/index.d.ts +4 -0
  29. package/dist/{apps/server/src/db → packages/db-core/src}/schema/auth.d.ts +26 -9
  30. package/dist/packages/db-core/src/schema/blog.d.ts +219 -0
  31. package/dist/{apps/server/src/db → packages/db-core/src}/schema/entity.d.ts +2 -2
  32. package/dist/{apps/server/src/db → packages/db-core/src}/schema/index.d.ts +3 -0
  33. package/dist/packages/db-core/src/schema/organization.d.ts +158 -0
  34. package/dist/{apps/server/src/db → packages/db-core/src}/schema/payment.d.ts +18 -1
  35. package/dist/packages/db-core/src/schema/studyPlan.d.ts +511 -0
  36. package/dist/{apps/server/src/db → packages/db-core/src}/utils.d.ts +1 -0
  37. package/dist/packages/db-core/src/views/deck.d.ts +79 -0
  38. package/dist/packages/shared/src/date/format.d.ts +1 -0
  39. package/dist/packages/shared/src/eden.d.ts +43 -0
  40. package/dist/packages/shared/src/index.d.ts +1 -0
  41. package/dist/packages/shared/src/theme/data-colors.d.ts +2 -0
  42. package/dist/packages/shared/src/theme/index.d.ts +3 -0
  43. package/dist/packages/shared/src/theme/tokens/border.d.ts +11 -0
  44. package/dist/packages/shared/src/theme/tokens/colors.d.ts +356 -0
  45. package/dist/packages/shared/src/theme/utils.d.ts +7 -0
  46. package/dist/packages/shared/src/types/blog.d.ts +8 -0
  47. package/dist/packages/shared/src/types/deck.d.ts +2 -1
  48. package/dist/packages/shared/src/types/fsrs.d.ts +9 -8
  49. package/dist/packages/shared/src/types/index.d.ts +3 -0
  50. package/dist/packages/shared/src/types/permissions.d.ts +108 -0
  51. package/dist/packages/shared/src/types/studyPlan.d.ts +5 -0
  52. package/dist/packages/shared/src/types/subject.d.ts +19 -2
  53. package/package.json +1 -1
  54. package/dist/apps/server/src/db/index.d.ts +0 -6
  55. package/dist/apps/server/src/db/migrate.d.ts +0 -1
  56. package/dist/apps/server/src/db/types.d.ts +0 -2
  57. package/dist/apps/server/src/utils/uuid.d.ts +0 -1
  58. /package/dist/{apps/server/src/db → packages/db-core/src}/schema/data.d.ts +0 -0
  59. /package/dist/{apps/server/src/db → packages/db-core/src}/schema/deck.d.ts +0 -0
  60. /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("../auth/permissions/permissions").Permission | undefined;
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 400 | 401 | 403 | 404 | 409 | 429 | 500 | 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
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("../auth/permissions/permissions").Permission) => {
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 400 | 401 | 403 | 404 | 409 | 429 | 500 | 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
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: "ALL" | "DECK" | "TOPIC" | "SUBJECT";
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: "ALL" | "DECK" | "TOPIC" | "SUBJECT";
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-server/db';
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").TUnion<[import("@sinclair/typebox").TLiteral<"Again">, import("@sinclair/typebox").TLiteral<"Hard">, import("@sinclair/typebox").TLiteral<"Good">, import("@sinclair/typebox").TLiteral<"Easy">]>;
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("../auth/permissions/permissions").Permission | undefined;
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 400 | 401 | 403 | 404 | 409 | 429 | 500 | 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
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("../auth/permissions/permissions").Permission) => {
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 400 | 401 | 403 | 404 | 409 | 429 | 500 | 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
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: unknown;
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: unknown;
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("../auth/permissions/permissions").Permission | undefined;
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 400 | 401 | 403 | 404 | 409 | 429 | 500 | 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
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("../auth/permissions/permissions").Permission) => {
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 400 | 401 | 403 | 404 | 409 | 429 | 500 | 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
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,5 +1,5 @@
1
+ import { UserRole } from '@vestcards/shared';
1
2
  import type { auth } from 'src/modules/auth/lib';
2
- import { UserRole } from '../../db';
3
3
  /**
4
4
  * Sign up a new user
5
5
  */
@@ -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
  }>;
@@ -146,3 +147,44 @@ export declare function deleteUserDeckStudy(userDeckStudyId: string): Promise<vo
146
147
  * Delete a card report (card demand)
147
148
  */
148
149
  export declare function deleteCardReport(userId: string, cardId: string): Promise<void>;
150
+ /**
151
+ * Create an official entity with an associated user
152
+ */
153
+ export declare function createOfficialEntity(): Promise<{
154
+ entityId: `${string}-${string}-${string}-${string}-${string}`;
155
+ userId: `${string}-${string}-${string}-${string}-${string}`;
156
+ }>;
157
+ /**
158
+ * Delete an official entity (user deleted via cascade on entity)
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 { type CardReview } from '@vestcards/db-core';
1
2
  import type { Subject } from '@vestcards/shared';
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<{
@@ -0,0 +1,4 @@
1
+ import { Pool } from 'pg';
2
+ export declare const db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, never>> & {
3
+ $client: Pool;
4
+ };
@@ -0,0 +1,4 @@
1
+ export { db } from './db';
2
+ export * from './schema';
3
+ export * from './utils';
4
+ export * from './views/deck';