@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
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import { UserRole } from '@vestcards/shared';
|
|
1
2
|
import { type BetterAuthOptions } from 'better-auth';
|
|
2
|
-
import { UserRole } from '../../db';
|
|
3
|
-
import { generateId } from '../../utils/uuid';
|
|
4
3
|
export declare const auth: import("better-auth").Auth<{
|
|
5
4
|
plugins: [{
|
|
6
5
|
id: "open-api";
|
|
@@ -45,7 +44,7 @@ export declare const auth: import("better-auth").Auth<{
|
|
|
45
44
|
}[];
|
|
46
45
|
paths: Record<string, import("better-auth/plugins").Path>;
|
|
47
46
|
}>;
|
|
48
|
-
openAPIReference: import("better-call").StrictEndpoint<"/reference", {
|
|
47
|
+
openAPIReference: import("better-call").StrictEndpoint<import("better-auth").LiteralString | "/reference", {
|
|
49
48
|
method: "GET";
|
|
50
49
|
metadata: {
|
|
51
50
|
readonly scope: "server";
|
|
@@ -95,6 +94,23 @@ export declare const auth: import("better-auth").Auth<{
|
|
|
95
94
|
}>;
|
|
96
95
|
};
|
|
97
96
|
options: import("@better-auth/expo").ExpoOptions | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
id: "bearer";
|
|
99
|
+
hooks: {
|
|
100
|
+
before: {
|
|
101
|
+
matcher(context: import("better-auth").HookEndpointContext): boolean;
|
|
102
|
+
handler: (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
103
|
+
context: {
|
|
104
|
+
headers: Headers;
|
|
105
|
+
};
|
|
106
|
+
} | undefined>;
|
|
107
|
+
}[];
|
|
108
|
+
after: {
|
|
109
|
+
matcher(context: import("better-auth").HookEndpointContext): true;
|
|
110
|
+
handler: (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>;
|
|
111
|
+
}[];
|
|
112
|
+
};
|
|
113
|
+
options: import("better-auth/plugins").BearerOptions | undefined;
|
|
98
114
|
}, {
|
|
99
115
|
id: "custom-session";
|
|
100
116
|
hooks: {
|
|
@@ -115,6 +131,7 @@ export declare const auth: import("better-auth").Auth<{
|
|
|
115
131
|
};
|
|
116
132
|
session: {
|
|
117
133
|
entitlements: import("@vestcards/shared").Entitlement[];
|
|
134
|
+
completedProfile: boolean;
|
|
118
135
|
id: string;
|
|
119
136
|
createdAt: Date;
|
|
120
137
|
updatedAt: Date;
|
|
@@ -172,6 +189,7 @@ export declare const auth: import("better-auth").Auth<{
|
|
|
172
189
|
};
|
|
173
190
|
session: {
|
|
174
191
|
entitlements: import("@vestcards/shared").Entitlement[];
|
|
192
|
+
completedProfile: boolean;
|
|
175
193
|
id: string;
|
|
176
194
|
createdAt: Date;
|
|
177
195
|
updatedAt: Date;
|
|
@@ -199,6 +217,7 @@ export declare const auth: import("better-auth").Auth<{
|
|
|
199
217
|
};
|
|
200
218
|
session: {
|
|
201
219
|
entitlements: import("@vestcards/shared").Entitlement[];
|
|
220
|
+
completedProfile: boolean;
|
|
202
221
|
id: string;
|
|
203
222
|
createdAt: Date;
|
|
204
223
|
updatedAt: Date;
|
|
@@ -219,7 +238,7 @@ export declare const auth: import("better-auth").Auth<{
|
|
|
219
238
|
emailAndPassword: {
|
|
220
239
|
enabled: true;
|
|
221
240
|
autoSignIn: true;
|
|
222
|
-
requireEmailVerification:
|
|
241
|
+
requireEmailVerification: false;
|
|
223
242
|
minPasswordLength: number;
|
|
224
243
|
maxPasswordLength: number;
|
|
225
244
|
password: {
|
|
@@ -255,12 +274,21 @@ export declare const auth: import("better-auth").Auth<{
|
|
|
255
274
|
required: false;
|
|
256
275
|
defaultValue: never[];
|
|
257
276
|
};
|
|
277
|
+
completedProfile: {
|
|
278
|
+
type: "boolean";
|
|
279
|
+
required: false;
|
|
280
|
+
defaultValue: false;
|
|
281
|
+
};
|
|
258
282
|
};
|
|
259
283
|
};
|
|
260
284
|
socialProviders: {
|
|
261
285
|
google: {
|
|
262
286
|
clientId: string;
|
|
263
287
|
clientSecret: string;
|
|
288
|
+
mapProfileToUser: (profile: import("better-auth").GoogleProfile) => {
|
|
289
|
+
name: string;
|
|
290
|
+
surname: string;
|
|
291
|
+
};
|
|
264
292
|
};
|
|
265
293
|
apple: {
|
|
266
294
|
clientId: string;
|
|
@@ -311,6 +339,31 @@ export declare const auth: import("better-auth").Auth<{
|
|
|
311
339
|
}>;
|
|
312
340
|
};
|
|
313
341
|
};
|
|
342
|
+
session: {
|
|
343
|
+
create: {
|
|
344
|
+
before: (session: {
|
|
345
|
+
id: string;
|
|
346
|
+
createdAt: Date;
|
|
347
|
+
updatedAt: Date;
|
|
348
|
+
userId: string;
|
|
349
|
+
expiresAt: Date;
|
|
350
|
+
token: string;
|
|
351
|
+
ipAddress?: string | null | undefined;
|
|
352
|
+
userAgent?: string | null | undefined;
|
|
353
|
+
} & Record<string, unknown>) => Promise<{
|
|
354
|
+
data: {
|
|
355
|
+
id: string;
|
|
356
|
+
createdAt: Date;
|
|
357
|
+
updatedAt: Date;
|
|
358
|
+
userId: string;
|
|
359
|
+
expiresAt: Date;
|
|
360
|
+
token: string;
|
|
361
|
+
ipAddress?: string | null | undefined;
|
|
362
|
+
userAgent?: string | null | undefined;
|
|
363
|
+
} & Record<string, unknown>;
|
|
364
|
+
}>;
|
|
365
|
+
};
|
|
366
|
+
};
|
|
314
367
|
};
|
|
315
368
|
logger: {
|
|
316
369
|
log(level: "error" | "warn" | "info" | "debug", message: string, ...args: any[]): void;
|
|
@@ -319,10 +372,17 @@ export declare const auth: import("better-auth").Auth<{
|
|
|
319
372
|
useSecureCookies: boolean;
|
|
320
373
|
disableOriginCheck: true;
|
|
321
374
|
cookiePrefix: string;
|
|
375
|
+
defaultCookieAttributes: {
|
|
376
|
+
sameSite: "lax" | "none";
|
|
377
|
+
secure: boolean;
|
|
378
|
+
};
|
|
322
379
|
database: {
|
|
323
|
-
generateId:
|
|
380
|
+
generateId: false;
|
|
324
381
|
};
|
|
325
382
|
};
|
|
326
383
|
trustedOrigins: string[];
|
|
384
|
+
hooks: {
|
|
385
|
+
before: (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>;
|
|
386
|
+
};
|
|
327
387
|
}>;
|
|
328
388
|
export type Auth = typeof auth;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hasUserCompletedProfile(userId: string): Promise<boolean>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Entitlement } from '
|
|
1
|
+
import { Entitlement } from '@vestcards/shared';
|
|
2
2
|
export declare function getUserEntitlements(userId: string): Promise<Entitlement[]>;
|
|
@@ -1,66 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
readonly DECK: {
|
|
4
|
-
readonly CREATE_OWN: "deck:create:own";
|
|
5
|
-
readonly CREATE_PUBLIC: "deck:create:public";
|
|
6
|
-
readonly READ_OWN: "deck:read:own";
|
|
7
|
-
readonly READ_FREE: "deck:read:free";
|
|
8
|
-
readonly READ_PREMIUM: "deck:read:premium";
|
|
9
|
-
readonly READ_PRIVATE: "deck:read:private";
|
|
10
|
-
readonly UPDATE_OWN: "deck:update:own";
|
|
11
|
-
readonly UPDATE_PUBLIC: "deck:update:public";
|
|
12
|
-
readonly DELETE_OWN: "deck:delete:own";
|
|
13
|
-
readonly DELETE_PUBLIC: "deck:delete:public";
|
|
14
|
-
};
|
|
15
|
-
readonly CARD_DEMAND: {
|
|
16
|
-
readonly READ: "card-demand:read";
|
|
17
|
-
readonly CREATE: "card-demand:create";
|
|
18
|
-
readonly ACTION: "card-demand:action";
|
|
19
|
-
};
|
|
20
|
-
readonly USER: {
|
|
21
|
-
readonly UPDATE_OWN: "user:update:own";
|
|
22
|
-
readonly UPDATE_ALL: "user:update:*";
|
|
23
|
-
readonly DELETE_OWN: "user:delete:own";
|
|
24
|
-
readonly DELETE_ALL: "user:delete:*";
|
|
25
|
-
readonly READ_OWN: "user:read:own";
|
|
26
|
-
readonly READ_ALL: "user:read:*";
|
|
27
|
-
};
|
|
28
|
-
readonly STATS: {
|
|
29
|
-
readonly VIEW: "stats:view";
|
|
30
|
-
};
|
|
31
|
-
readonly MEMBERSHIP: {
|
|
32
|
-
readonly MANAGE: "membership:manage";
|
|
33
|
-
};
|
|
34
|
-
readonly PLAN: {
|
|
35
|
-
readonly CREATE: "plan:create";
|
|
36
|
-
readonly UPDATE: "plan:update";
|
|
37
|
-
readonly DELETE: "plan:delete";
|
|
38
|
-
};
|
|
39
|
-
readonly BLOGPOST: {
|
|
40
|
-
readonly CREATE: "blogpost:create";
|
|
41
|
-
readonly UPDATE: "blogpost:update";
|
|
42
|
-
readonly DELETE: "blogpost:delete";
|
|
43
|
-
};
|
|
44
|
-
readonly VESTY: {
|
|
45
|
-
readonly CHAT: "vesty:chat";
|
|
46
|
-
};
|
|
47
|
-
readonly STUDY: {
|
|
48
|
-
readonly READ: "study:read";
|
|
49
|
-
readonly WRITE: "study:write";
|
|
50
|
-
};
|
|
51
|
-
readonly LIBRARY: {
|
|
52
|
-
readonly READ: "library:read";
|
|
53
|
-
readonly WRITE: "library:write";
|
|
54
|
-
readonly WRITE_PREMIUM: "library:write:premium";
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
declare const ALL_PERMISSIONS: ("deck:create:own" | "deck:create:public" | "deck:read:own" | "deck:read:free" | "deck:read:premium" | "deck:read:private" | "deck:update:own" | "deck:update:public" | "deck:delete:own" | "deck:delete:public" | "card-demand:read" | "card-demand:create" | "card-demand:action" | "user:update:own" | "user:update:*" | "user:delete:own" | "user:delete:*" | "user:read:own" | "user:read:*" | "stats:view" | "membership:manage" | "plan:create" | "plan:update" | "plan:delete" | "blogpost:create" | "blogpost:update" | "blogpost:delete" | "vesty:chat" | "study:read" | "study:write" | "library:read" | "library:write" | "library:write:premium")[];
|
|
58
|
-
declare const ROLE_PERMISSIONS: Record<UserRole, Permission[]>;
|
|
59
|
-
declare const ENTITLEMENT_PERMISSIONS: Record<Entitlement, Permission[]>;
|
|
60
|
-
type ValueOf<T> = T[keyof T];
|
|
61
|
-
type Permission = ValueOf<{
|
|
62
|
-
[K in keyof typeof PERMISSIONS]: ValueOf<(typeof PERMISSIONS)[K]>;
|
|
63
|
-
}>;
|
|
64
|
-
declare const hasPermission: (required: Permission, userRole?: UserRole, userEntitlements?: Entitlement[]) => boolean;
|
|
65
|
-
export { ALL_PERMISSIONS, ENTITLEMENT_PERMISSIONS, hasPermission, PERMISSIONS, ROLE_PERMISSIONS };
|
|
66
|
-
export type { Permission };
|
|
1
|
+
export type { Permission } from '@vestcards/shared';
|
|
2
|
+
export { ALL_PERMISSIONS, ENTITLEMENT_PERMISSIONS, hasPermission, PERMISSIONS, ROLE_PERMISSIONS } from '@vestcards/shared';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BetterAuthOptions } from 'better-auth';
|
|
2
|
+
export declare function assertCredentialAccount(userId: string): Promise<void>;
|
|
2
3
|
type SendVerificationEmail = NonNullable<BetterAuthOptions['emailVerification']>['sendVerificationEmail'];
|
|
3
4
|
export declare const sendVerificationEmail: SendVerificationEmail;
|
|
4
5
|
type SendResetPassword = NonNullable<BetterAuthOptions['emailAndPassword']>['sendResetPassword'];
|
|
@@ -20,7 +20,7 @@ export declare const cardModule: Elysia<"/v1/card", {
|
|
|
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 cardModule: Elysia<"/v1/card", {
|
|
|
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 cardModule: Elysia<"/v1/card", {
|
|
|
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 cardModule: Elysia<"/v1/card", {
|
|
|
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,71 @@ export declare const cardModule: Elysia<"/v1/card", {
|
|
|
346
348
|
response: {};
|
|
347
349
|
}, {
|
|
348
350
|
v1: {
|
|
349
|
-
card: {
|
|
351
|
+
card: {
|
|
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
|
+
};
|
|
381
|
+
};
|
|
382
|
+
} & {
|
|
383
|
+
v1: {
|
|
384
|
+
card: {
|
|
385
|
+
report: {
|
|
386
|
+
get: {
|
|
387
|
+
body: {};
|
|
388
|
+
params: {};
|
|
389
|
+
query: {
|
|
390
|
+
cardId: string;
|
|
391
|
+
};
|
|
392
|
+
headers: {};
|
|
393
|
+
response: {
|
|
394
|
+
200: {
|
|
395
|
+
status: "not-reviewed" | "card-updated" | "demand-rejected" | "card-removed";
|
|
396
|
+
type: string;
|
|
397
|
+
createdAt: Date;
|
|
398
|
+
updatedAt: Date;
|
|
399
|
+
userId: string;
|
|
400
|
+
content: string;
|
|
401
|
+
cardId: string;
|
|
402
|
+
} | null;
|
|
403
|
+
422: {
|
|
404
|
+
type: "validation";
|
|
405
|
+
on: string;
|
|
406
|
+
summary?: string;
|
|
407
|
+
message?: string;
|
|
408
|
+
found?: unknown;
|
|
409
|
+
property?: string;
|
|
410
|
+
expected?: string;
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
};
|
|
350
416
|
};
|
|
351
417
|
} & {
|
|
352
418
|
v1: {
|
|
@@ -355,8 +421,8 @@ export declare const cardModule: Elysia<"/v1/card", {
|
|
|
355
421
|
post: {
|
|
356
422
|
body: {
|
|
357
423
|
type: string;
|
|
358
|
-
cardId: string;
|
|
359
424
|
content: string;
|
|
425
|
+
cardId: string;
|
|
360
426
|
};
|
|
361
427
|
params: {};
|
|
362
428
|
query: {};
|
|
@@ -5,4 +5,8 @@ export declare namespace CardModel {
|
|
|
5
5
|
type: import("@sinclair/typebox").TString;
|
|
6
6
|
}>;
|
|
7
7
|
type ReportBody = typeof reportBody.static;
|
|
8
|
+
const reportQuery: import("@sinclair/typebox").TObject<{
|
|
9
|
+
cardId: import("@sinclair/typebox").TString;
|
|
10
|
+
}>;
|
|
11
|
+
type ReportQuery = typeof reportQuery.static;
|
|
8
12
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { CardDemand } from '@vestcards/db-core';
|
|
1
2
|
import type { CardModel } from './model';
|
|
2
3
|
export declare abstract class CardService {
|
|
4
|
+
static getReport(userId: string, cardId: string): Promise<CardDemand | null>;
|
|
3
5
|
static reportCard(userId: string, body: CardModel.ReportBody): Promise<void>;
|
|
4
6
|
}
|
|
@@ -20,7 +20,7 @@ export declare const deckModule: Elysia<"/v1/decks", {
|
|
|
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 deckModule: Elysia<"/v1/decks", {
|
|
|
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 deckModule: Elysia<"/v1/decks", {
|
|
|
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 deckModule: Elysia<"/v1/decks", {
|
|
|
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 deckModule: Elysia<"/v1/decks", {
|
|
|
346
348
|
response: {};
|
|
347
349
|
}, {
|
|
348
350
|
v1: {
|
|
349
|
-
decks: {
|
|
351
|
+
decks: {
|
|
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
|
decks: {
|
|
354
385
|
get: {
|
|
355
|
-
body:
|
|
386
|
+
body: {};
|
|
356
387
|
params: {};
|
|
357
388
|
query: {
|
|
358
389
|
sort?: string | undefined;
|
|
@@ -360,12 +391,13 @@ export declare const deckModule: Elysia<"/v1/decks", {
|
|
|
360
391
|
ownerId?: string | undefined;
|
|
361
392
|
order?: "asc" | "desc" | undefined;
|
|
362
393
|
q?: string | undefined;
|
|
363
|
-
|
|
364
|
-
|
|
394
|
+
ids?: string[] | undefined;
|
|
395
|
+
topicIds?: string[] | undefined;
|
|
396
|
+
subjects?: ("matemática" | "geografia" | "física" | "biologia" | "história" | "literatura" | "gramática" | "sociologia" | "química" | "filosofia" | "redação" | "artes" | "inglês")[] | undefined;
|
|
365
397
|
size: number;
|
|
366
398
|
page: number;
|
|
367
399
|
};
|
|
368
|
-
headers:
|
|
400
|
+
headers: {};
|
|
369
401
|
response: {
|
|
370
402
|
200: {
|
|
371
403
|
data: import("@vestcards/shared").IDeck[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Subject } from '@vestcards/shared';
|
|
2
2
|
import { type Pagination, type Search, type Sort } from '../../utils/api';
|
|
3
3
|
export declare namespace DeckModel {
|
|
4
4
|
const deckFilter: (ownerId?: string) => import("drizzle-orm").SQL<unknown> | undefined;
|
|
@@ -10,8 +10,9 @@ export declare namespace DeckModel {
|
|
|
10
10
|
q: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
11
11
|
free: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
12
12
|
ownerId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
ids: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
14
|
+
topicIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
15
|
+
subjects: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TEnum<Record<"matemática" | "geografia" | "física" | "biologia" | "história" | "literatura" | "gramática" | "sociologia" | "química" | "filosofia" | "redação" | "artes" | "inglês", "matemática" | "geografia" | "física" | "biologia" | "história" | "literatura" | "gramática" | "sociologia" | "química" | "filosofia" | "redação" | "artes" | "inglês">>>>;
|
|
15
16
|
}>;
|
|
16
17
|
type ListQuery = typeof listQuery.static;
|
|
17
18
|
const deckIdParams: import("@sinclair/typebox").TObject<{
|
|
@@ -27,6 +28,7 @@ export declare namespace DeckModel {
|
|
|
27
28
|
}>;
|
|
28
29
|
type TopicIdParams = typeof topicIdParams.static;
|
|
29
30
|
interface DeckListFilters extends Pagination, Sort, Search {
|
|
31
|
+
ids?: string[];
|
|
30
32
|
topicIds?: string[];
|
|
31
33
|
subjects?: Subject[];
|
|
32
34
|
free?: boolean;
|
|
@@ -20,7 +20,7 @@ export declare const libraryModule: Elysia<"/v1/library", {
|
|
|
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 libraryModule: Elysia<"/v1/library", {
|
|
|
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 libraryModule: Elysia<"/v1/library", {
|
|
|
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 libraryModule: Elysia<"/v1/library", {
|
|
|
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 libraryModule: Elysia<"/v1/library", {
|
|
|
346
348
|
response: {};
|
|
347
349
|
}, {
|
|
348
350
|
v1: {
|
|
349
|
-
library: {
|
|
351
|
+
library: {
|
|
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: {
|
|
@@ -362,6 +393,25 @@ export declare const libraryModule: Elysia<"/v1/library", {
|
|
|
362
393
|
};
|
|
363
394
|
};
|
|
364
395
|
};
|
|
396
|
+
} & {
|
|
397
|
+
v1: {
|
|
398
|
+
library: {
|
|
399
|
+
summary: {
|
|
400
|
+
get: {
|
|
401
|
+
body: {};
|
|
402
|
+
params: {};
|
|
403
|
+
query: {};
|
|
404
|
+
headers: {};
|
|
405
|
+
response: {
|
|
406
|
+
200: {
|
|
407
|
+
deckId: string;
|
|
408
|
+
inLibrary: boolean;
|
|
409
|
+
}[];
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
};
|
|
365
415
|
} & {
|
|
366
416
|
v1: {
|
|
367
417
|
library: {
|
|
@@ -2,6 +2,10 @@ import type { IArchivedLibraryItem, IGroupedLibraryData } from '@vestcards/share
|
|
|
2
2
|
export declare abstract class LibraryService {
|
|
3
3
|
static getGroupedLibraryData(userId: string): Promise<IGroupedLibraryData>;
|
|
4
4
|
static getArchivedLibraryData(userId: string): Promise<IArchivedLibraryItem[]>;
|
|
5
|
+
static getLibrarySummary(userId: string): Promise<{
|
|
6
|
+
deckId: string;
|
|
7
|
+
inLibrary: boolean;
|
|
8
|
+
}[]>;
|
|
5
9
|
static startDeckStudy(userId: string, deckId: string): Promise<void>;
|
|
6
10
|
static deleteDeckStudy(userId: string, deckId: string): Promise<void>;
|
|
7
11
|
static updateDeckStudySuspended(userId: string, deckId: string, suspended: boolean): Promise<void>;
|