@vestcards/server-types 1.0.1 → 1.0.2
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 +1 -0
- package/dist/apps/server/src/modules/auth/permissions/permissions.d.ts +3 -2
- package/dist/apps/server/src/modules/deck/index.d.ts +1 -0
- package/dist/apps/server/src/modules/deck/model.d.ts +4 -1
- package/dist/apps/server/src/modules/deck/service.d.ts +4 -3
- package/dist/apps/server/src/tests/helpers/fixtures.d.ts +11 -0
- package/dist/packages/shared/src/date/format.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ declare const PERMISSIONS: {
|
|
|
6
6
|
readonly READ_OWN: "deck:read:own";
|
|
7
7
|
readonly READ_FREE: "deck:read:free";
|
|
8
8
|
readonly READ_PREMIUM: "deck:read:premium";
|
|
9
|
+
readonly READ_PRIVATE: "deck:read:private";
|
|
9
10
|
readonly UPDATE_OWN: "deck:update:own";
|
|
10
11
|
readonly UPDATE_PUBLIC: "deck:update:public";
|
|
11
12
|
readonly DELETE_OWN: "deck:delete:own";
|
|
@@ -53,13 +54,13 @@ declare const PERMISSIONS: {
|
|
|
53
54
|
readonly WRITE_PREMIUM: "library:write:premium";
|
|
54
55
|
};
|
|
55
56
|
};
|
|
56
|
-
declare const ALL_PERMISSIONS: ("deck:create:own" | "deck:create:public" | "deck:read:own" | "deck:read:free" | "deck:read:premium" | "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")[];
|
|
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")[];
|
|
57
58
|
declare const ROLE_PERMISSIONS: Record<UserRole, Permission[]>;
|
|
58
59
|
declare const ENTITLEMENT_PERMISSIONS: Record<Entitlement, Permission[]>;
|
|
59
60
|
type ValueOf<T> = T[keyof T];
|
|
60
61
|
type Permission = ValueOf<{
|
|
61
62
|
[K in keyof typeof PERMISSIONS]: ValueOf<(typeof PERMISSIONS)[K]>;
|
|
62
63
|
}>;
|
|
63
|
-
declare const hasPermission: (required: Permission, userRole
|
|
64
|
+
declare const hasPermission: (required: Permission, userRole?: UserRole, userEntitlements?: Entitlement[]) => boolean;
|
|
64
65
|
export { ALL_PERMISSIONS, ENTITLEMENT_PERMISSIONS, hasPermission, PERMISSIONS, ROLE_PERMISSIONS };
|
|
65
66
|
export type { Permission };
|
|
@@ -357,6 +357,7 @@ export declare const deckModule: Elysia<"/v1/decks", {
|
|
|
357
357
|
query: {
|
|
358
358
|
sort?: string | undefined;
|
|
359
359
|
free?: boolean | undefined;
|
|
360
|
+
ownerId?: string | undefined;
|
|
360
361
|
order?: "asc" | "desc" | undefined;
|
|
361
362
|
q?: string | undefined;
|
|
362
363
|
topicIds?: string | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
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
|
+
const deckFilter: (ownerId?: string) => import("drizzle-orm").SQL<unknown> | undefined;
|
|
4
5
|
const listQuery: import("@sinclair/typebox").TObject<{
|
|
5
6
|
size: import("@sinclair/typebox").TNumber;
|
|
6
7
|
page: import("@sinclair/typebox").TNumber;
|
|
@@ -8,6 +9,7 @@ export declare namespace DeckModel {
|
|
|
8
9
|
order: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"asc">, import("@sinclair/typebox").TLiteral<"desc">]>>;
|
|
9
10
|
q: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
10
11
|
free: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
12
|
+
ownerId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
11
13
|
topicIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
12
14
|
subjects: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
13
15
|
}>;
|
|
@@ -25,8 +27,9 @@ export declare namespace DeckModel {
|
|
|
25
27
|
}>;
|
|
26
28
|
type TopicIdParams = typeof topicIdParams.static;
|
|
27
29
|
interface DeckListFilters extends Pagination, Sort, Search {
|
|
30
|
+
topicIds?: string[];
|
|
28
31
|
subjects?: Subject[];
|
|
29
32
|
free?: boolean;
|
|
30
|
-
|
|
33
|
+
ownerId?: string;
|
|
31
34
|
}
|
|
32
35
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IDeck, IDeckDetail, IOwnerInfo } from '@vestcards/shared';
|
|
2
2
|
import { type Paginated } from '../../utils/api';
|
|
3
|
-
import
|
|
3
|
+
import { DeckModel } from './model';
|
|
4
4
|
export declare abstract class DeckService {
|
|
5
|
-
static getAllDecks(filters: DeckModel.DeckListFilters): Promise<Paginated<IDeck>>;
|
|
5
|
+
static getAllDecks(filters: DeckModel.DeckListFilters, loggedUserId?: string): Promise<Paginated<IDeck>>;
|
|
6
6
|
static getDeck(deckId: string): Promise<IDeckDetail>;
|
|
7
|
+
static getOwnerInfoById(ownerId: string): Promise<IOwnerInfo>;
|
|
7
8
|
}
|
|
@@ -146,3 +146,14 @@ export declare function deleteUserDeckStudy(userDeckStudyId: string): Promise<vo
|
|
|
146
146
|
* Delete a card report (card demand)
|
|
147
147
|
*/
|
|
148
148
|
export declare function deleteCardReport(userId: string, cardId: string): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Create an official entity with an associated user
|
|
151
|
+
*/
|
|
152
|
+
export declare function createOfficialEntity(): Promise<{
|
|
153
|
+
entityId: `${string}-${string}-${string}-${string}-${string}`;
|
|
154
|
+
userId: `${string}-${string}-${string}-${string}-${string}`;
|
|
155
|
+
}>;
|
|
156
|
+
/**
|
|
157
|
+
* Delete an official entity (user deleted via cascade on entity)
|
|
158
|
+
*/
|
|
159
|
+
export declare function deleteOfficialEntity(entityId: string): Promise<void>;
|