@vestcards/server-types 0.1.0 → 0.3.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 +161 -144
- package/dist/apps/server/src/config/env.d.ts +1 -0
- package/dist/apps/server/src/middleware/errorHandler.d.ts +10 -16
- package/dist/apps/server/src/modules/auth/index.d.ts +2 -2
- package/dist/apps/server/src/modules/auth/permissions/permissions.d.ts +6 -1
- package/dist/apps/server/src/modules/deck/index.d.ts +10 -53
- package/dist/apps/server/src/modules/lead/index.d.ts +9 -37
- package/dist/apps/server/src/modules/library/index.d.ts +492 -0
- package/dist/apps/server/src/modules/library/library.test.d.ts +1 -0
- package/dist/apps/server/src/modules/library/model.d.ts +8 -0
- package/dist/apps/server/src/modules/library/service.d.ts +10 -0
- package/dist/apps/server/src/modules/study/index.d.ts +15 -67
- package/dist/apps/server/src/modules/study/service.d.ts +7 -0
- package/dist/apps/server/src/modules/study/utils.d.ts +4 -0
- package/dist/apps/server/src/modules/topic/index.d.ts +9 -37
- package/dist/apps/server/src/modules/user/index.d.ts +4 -17
- package/dist/apps/server/src/tests/helpers/fixtures.d.ts +1 -1
- package/dist/apps/server/src/tests/helpers/http-helpers.d.ts +4 -0
- package/dist/apps/server/src/types/study.d.ts +1 -1
- package/dist/packages/shared/src/types/deck.d.ts +0 -1
- package/dist/packages/shared/src/types/study.d.ts +17 -0
- package/package.json +1 -1
|
@@ -8,6 +8,13 @@ export declare abstract class StudyService {
|
|
|
8
8
|
type: StudyType, id?: string): Promise<SessionStats>;
|
|
9
9
|
static getReviewCards(userId: string, type: StudyType, id?: string, maxToFetch?: number): Promise<import("../../types/study").SessionCard[]>;
|
|
10
10
|
static getNewCards(userId: string, allocatedNewForToday: number, type: StudyType, id?: string): Promise<import("../../types/study").SessionCard[]>;
|
|
11
|
+
static getUserDeckStudy(userId: string, deckId: string): Promise<{
|
|
12
|
+
suspended: boolean;
|
|
13
|
+
id: string;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
userId: string;
|
|
16
|
+
deckId: string;
|
|
17
|
+
}>;
|
|
11
18
|
static getCardReview(userId: string, cardId: string): Promise<CardReview>;
|
|
12
19
|
static gradeCard(userId: string, input: StudyModel.GradeCardBody): Promise<void>;
|
|
13
20
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SessionStats, StudyStatus } from '@vestcards/shared';
|
|
1
2
|
import type { SessionCard, StudyType } from 'src/types/study';
|
|
2
3
|
import type { SessionCardSelect } from 'src/utils/select';
|
|
3
4
|
export declare const getSessionFilterByStudyType: (type: StudyType, id?: string) => import("drizzle-orm").SQL<unknown> | undefined;
|
|
@@ -11,4 +12,7 @@ export declare const allocateByPriority: (capacityLeft: number, counts: {
|
|
|
11
12
|
new: number;
|
|
12
13
|
total: number;
|
|
13
14
|
};
|
|
15
|
+
export declare function getStudyStatus(stats: SessionStats, userDeckStudy: {
|
|
16
|
+
suspended: boolean;
|
|
17
|
+
} | undefined): StudyStatus;
|
|
14
18
|
export declare function sessionCardToICard(sessionRows: SessionCardSelect[]): SessionCard[];
|
|
@@ -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 |
|
|
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 ? {
|
|
46
46
|
readonly 100: "Continue";
|
|
47
47
|
readonly 101: "Switching Protocols";
|
|
48
48
|
readonly 102: "Processing";
|
|
@@ -214,7 +214,7 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
214
214
|
route: string;
|
|
215
215
|
request: Request;
|
|
216
216
|
store: {};
|
|
217
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 404 | 409 | 429 | 500 |
|
|
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 ? {
|
|
218
218
|
readonly 100: "Continue";
|
|
219
219
|
readonly 101: "Switching Protocols";
|
|
220
220
|
readonly 102: "Processing";
|
|
@@ -364,6 +364,11 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
364
364
|
};
|
|
365
365
|
headers: unknown;
|
|
366
366
|
response: {
|
|
367
|
+
200: {
|
|
368
|
+
data: import("@vestcards/shared").Topic[];
|
|
369
|
+
pageCount: number;
|
|
370
|
+
total: number;
|
|
371
|
+
};
|
|
367
372
|
422: {
|
|
368
373
|
type: "validation";
|
|
369
374
|
on: string;
|
|
@@ -373,26 +378,6 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
373
378
|
property?: string;
|
|
374
379
|
expected?: string;
|
|
375
380
|
};
|
|
376
|
-
200: {
|
|
377
|
-
error: string;
|
|
378
|
-
message: string;
|
|
379
|
-
path: any;
|
|
380
|
-
details?: undefined;
|
|
381
|
-
} | {
|
|
382
|
-
error: string;
|
|
383
|
-
message: string;
|
|
384
|
-
details: any;
|
|
385
|
-
path?: undefined;
|
|
386
|
-
} | {
|
|
387
|
-
error: string;
|
|
388
|
-
message: string;
|
|
389
|
-
path?: undefined;
|
|
390
|
-
details?: undefined;
|
|
391
|
-
} | {
|
|
392
|
-
data: import("@vestcards/shared").Topic[];
|
|
393
|
-
pageCount: number;
|
|
394
|
-
total: number;
|
|
395
|
-
};
|
|
396
381
|
};
|
|
397
382
|
};
|
|
398
383
|
};
|
|
@@ -409,21 +394,8 @@ export declare const topicModule: Elysia<"/v1/topics", {
|
|
|
409
394
|
schema: {};
|
|
410
395
|
standaloneSchema: {};
|
|
411
396
|
response: {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
message: string;
|
|
415
|
-
path: any;
|
|
416
|
-
details?: undefined;
|
|
417
|
-
} | {
|
|
418
|
-
error: string;
|
|
419
|
-
message: string;
|
|
420
|
-
details: any;
|
|
421
|
-
path?: undefined;
|
|
422
|
-
} | {
|
|
423
|
-
error: string;
|
|
424
|
-
message: string;
|
|
425
|
-
path?: undefined;
|
|
426
|
-
details?: undefined;
|
|
397
|
+
[x: string]: {
|
|
398
|
+
[x: string]: any;
|
|
427
399
|
};
|
|
428
400
|
};
|
|
429
401
|
}>;
|
|
@@ -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 |
|
|
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 ? {
|
|
46
46
|
readonly 100: "Continue";
|
|
47
47
|
readonly 101: "Switching Protocols";
|
|
48
48
|
readonly 102: "Processing";
|
|
@@ -214,7 +214,7 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
214
214
|
route: string;
|
|
215
215
|
request: Request;
|
|
216
216
|
store: {};
|
|
217
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 404 | 409 | 429 | 500 |
|
|
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 ? {
|
|
218
218
|
readonly 100: "Continue";
|
|
219
219
|
readonly 101: "Switching Protocols";
|
|
220
220
|
readonly 102: "Processing";
|
|
@@ -360,21 +360,8 @@ export declare const userModule: Elysia<"/v1/user", {
|
|
|
360
360
|
schema: {};
|
|
361
361
|
standaloneSchema: {};
|
|
362
362
|
response: {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
message: string;
|
|
366
|
-
path: any;
|
|
367
|
-
details?: undefined;
|
|
368
|
-
} | {
|
|
369
|
-
error: string;
|
|
370
|
-
message: string;
|
|
371
|
-
details: any;
|
|
372
|
-
path?: undefined;
|
|
373
|
-
} | {
|
|
374
|
-
error: string;
|
|
375
|
-
message: string;
|
|
376
|
-
path?: undefined;
|
|
377
|
-
details?: undefined;
|
|
363
|
+
[x: string]: {
|
|
364
|
+
[x: string]: any;
|
|
378
365
|
};
|
|
379
366
|
};
|
|
380
367
|
}>;
|
|
@@ -102,11 +102,11 @@ export declare function createUserDeckStudy(data: {
|
|
|
102
102
|
userId: string;
|
|
103
103
|
suspended?: boolean;
|
|
104
104
|
}): Promise<{
|
|
105
|
+
suspended: boolean;
|
|
105
106
|
id: string;
|
|
106
107
|
createdAt: Date;
|
|
107
108
|
userId: string;
|
|
108
109
|
deckId: string;
|
|
109
|
-
suspended: boolean;
|
|
110
110
|
}>;
|
|
111
111
|
/**
|
|
112
112
|
* Create a card review for a user deck study
|
|
@@ -26,6 +26,10 @@ export declare function post<TResponse = unknown, TBody = unknown>(path: string,
|
|
|
26
26
|
* PUT request
|
|
27
27
|
*/
|
|
28
28
|
export declare function put<TResponse = unknown, TBody = unknown>(path: string, body: TBody, cookie?: string): Promise<HttpResponse<TResponse>>;
|
|
29
|
+
/**
|
|
30
|
+
* PATCH request
|
|
31
|
+
*/
|
|
32
|
+
export declare function patch<TResponse = unknown, TBody = unknown>(path: string, body: TBody, cookie?: string): Promise<HttpResponse<TResponse>>;
|
|
29
33
|
/**
|
|
30
34
|
* DELETE request
|
|
31
35
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Subject } from '@vestcards/shared';
|
|
2
2
|
import type { CardReview } from 'src/db/schema/deck';
|
|
3
|
-
export type { CardState, GradeCardInput, Rating, SessionStats, StudyType } from '@vestcards/shared';
|
|
3
|
+
export type { CardState, GradeCardInput, Rating, SessionStats, StudyStatus, StudyType } from '@vestcards/shared';
|
|
4
4
|
export interface ICard {
|
|
5
5
|
id: string;
|
|
6
6
|
question: string;
|
|
@@ -13,3 +13,20 @@ export interface GradeCardInput {
|
|
|
13
13
|
grade: Rating;
|
|
14
14
|
reviewDurationInSeconds: number;
|
|
15
15
|
}
|
|
16
|
+
export interface GroupedLibraryItem {
|
|
17
|
+
name: string;
|
|
18
|
+
id: string;
|
|
19
|
+
ownerId?: string;
|
|
20
|
+
type: StudyType;
|
|
21
|
+
stats: SessionStats;
|
|
22
|
+
subRows?: GroupedLibraryItem[];
|
|
23
|
+
}
|
|
24
|
+
export type GroupedLibraryData = GroupedLibraryItem[];
|
|
25
|
+
export type StudyStatus = 'not-started' | 'suspended' | 'has-cards' | 'no-cards';
|
|
26
|
+
export interface ArchivedLibraryItem {
|
|
27
|
+
deckId: string;
|
|
28
|
+
subject: string;
|
|
29
|
+
topic: string;
|
|
30
|
+
title: string;
|
|
31
|
+
ownerId?: string;
|
|
32
|
+
}
|