A social knowledge tool for researchers built on ATProto
1export interface CollectionQueryOptions {
2 page: number;
3 limit: number;
4 sortBy: CollectionSortField;
5 sortOrder: SortOrder;
6 searchText?: string;
7}
8
9export interface PaginatedQueryResult<T> {
10 items: T[];
11 totalCount: number;
12 hasMore: boolean;
13}
14
15export enum CollectionSortField {
16 NAME = 'name',
17 CREATED_AT = 'createdAt',
18 UPDATED_AT = 'updatedAt',
19 CARD_COUNT = 'cardCount',
20}
21
22export enum SortOrder {
23 ASC = 'asc',
24 DESC = 'desc',
25}
26
27export interface CollectionQueryResultDTO {
28 id: string;
29 uri?: string;
30 name: string;
31 description?: string;
32 updatedAt: Date;
33 createdAt: Date;
34 cardCount: number;
35 authorId: string;
36}
37
38export interface CollectionContainingCardDTO {
39 id: string;
40 uri?: string;
41 name: string;
42 description?: string;
43}
44
45export interface CollectionForUrlDTO {
46 id: string;
47 uri?: string;
48 name: string;
49 description?: string;
50 authorId: string;
51}
52
53export interface CollectionForUrlQueryOptions {
54 page: number;
55 limit: number;
56 sortBy: CollectionSortField;
57 sortOrder: SortOrder;
58}
59
60export interface ICollectionQueryRepository {
61 findByCreator(
62 curatorId: string,
63 options: CollectionQueryOptions,
64 ): Promise<PaginatedQueryResult<CollectionQueryResultDTO>>;
65
66 getCollectionsContainingCardForUser(
67 cardId: string,
68 curatorId: string,
69 ): Promise<CollectionContainingCardDTO[]>;
70
71 getCollectionsWithUrl(
72 url: string,
73 options: CollectionForUrlQueryOptions,
74 ): Promise<PaginatedQueryResult<CollectionForUrlDTO>>;
75}