This repository has no description
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 accessType: string;
33 updatedAt: Date;
34 createdAt: Date;
35 cardCount: number;
36 authorId: string;
37}
38
39export interface CollectionContainingCardDTO {
40 id: string;
41 uri?: string;
42 name: string;
43 description?: string;
44}
45
46// Raw repository DTO - what the repository returns (not enriched)
47export interface CollectionForUrlRawDTO {
48 id: string;
49 uri?: string;
50 name: string;
51 description?: string;
52 accessType: string;
53 authorId: string;
54}
55
56// Public DTO - what the use case returns (enriched with author profile)
57export interface CollectionForUrlDTO {
58 id: string;
59 uri?: string;
60 name: string;
61 description?: string;
62 accessType: string;
63 author: {
64 id: string;
65 name: string;
66 handle: string;
67 avatarUrl?: string;
68 };
69}
70
71export interface CollectionForUrlQueryOptions {
72 page: number;
73 limit: number;
74 sortBy: CollectionSortField;
75 sortOrder: SortOrder;
76}
77
78export interface SearchCollectionsOptions {
79 page: number;
80 limit: number;
81 sortBy: CollectionSortField;
82 sortOrder: SortOrder;
83 searchText?: string;
84 authorId?: string; // Filter by author DID
85 accessType?: string; // Filter by access type (OPEN or CLOSED)
86}
87
88export interface GetOpenCollectionsWithContributorOptions {
89 contributorId: string; // User DID who contributed cards
90 page: number;
91 limit: number;
92 sortBy: CollectionSortField;
93 sortOrder: SortOrder;
94}
95
96export interface CollectionContributorDTO {
97 userId: string;
98 contributionCount: number;
99 lastContributedAt: Date;
100}
101
102export interface ICollectionQueryRepository {
103 findByCreator(
104 curatorId: string,
105 options: CollectionQueryOptions,
106 ): Promise<PaginatedQueryResult<CollectionQueryResultDTO>>;
107
108 getCollectionsContainingCardForUser(
109 cardId: string,
110 curatorId: string,
111 ): Promise<CollectionContainingCardDTO[]>;
112
113 getCollectionsWithUrl(
114 url: string,
115 options: CollectionForUrlQueryOptions,
116 ): Promise<PaginatedQueryResult<CollectionForUrlRawDTO>>;
117
118 searchCollections(
119 options: SearchCollectionsOptions,
120 ): Promise<PaginatedQueryResult<CollectionQueryResultDTO>>;
121
122 getOpenCollectionsWithContributor(
123 options: GetOpenCollectionsWithContributorOptions,
124 ): Promise<PaginatedQueryResult<CollectionQueryResultDTO>>;
125
126 getCollectionContributors(
127 collectionId: string,
128 authorId: string,
129 options: { page: number; limit: number },
130 ): Promise<PaginatedQueryResult<CollectionContributorDTO>>;
131}