This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

semble / src / modules / cards / domain / ICollectionQueryRepository.ts
2.2 kB 104 lines
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 45// Raw repository DTO - what the repository returns (not enriched) 46export interface CollectionForUrlRawDTO { 47 id: string; 48 uri?: string; 49 name: string; 50 description?: string; 51 authorId: string; 52} 53 54// Public DTO - what the use case returns (enriched with author profile) 55export interface CollectionForUrlDTO { 56 id: string; 57 uri?: string; 58 name: string; 59 description?: string; 60 author: { 61 id: string; 62 name: string; 63 handle: string; 64 avatarUrl?: string; 65 }; 66} 67 68export interface CollectionForUrlQueryOptions { 69 page: number; 70 limit: number; 71 sortBy: CollectionSortField; 72 sortOrder: SortOrder; 73} 74 75export interface SearchCollectionsOptions { 76 page: number; 77 limit: number; 78 sortBy: CollectionSortField; 79 sortOrder: SortOrder; 80 searchText?: string; 81 authorId?: string; // Filter by author DID 82 accessType?: string; // Filter by access type (OPEN or CLOSED) 83} 84 85export interface ICollectionQueryRepository { 86 findByCreator( 87 curatorId: string, 88 options: CollectionQueryOptions, 89 ): Promise<PaginatedQueryResult<CollectionQueryResultDTO>>; 90 91 getCollectionsContainingCardForUser( 92 cardId: string, 93 curatorId: string, 94 ): Promise<CollectionContainingCardDTO[]>; 95 96 getCollectionsWithUrl( 97 url: string, 98 options: CollectionForUrlQueryOptions, 99 ): Promise<PaginatedQueryResult<CollectionForUrlRawDTO>>; 100 101 searchCollections( 102 options: SearchCollectionsOptions, 103 ): Promise<PaginatedQueryResult<CollectionQueryResultDTO>>; 104}