This repository has no description
0

Configure Feed

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

semble / src / modules / cards / infrastructure / http / controllers / GetCollectionContributorsController.ts
1.2 kB 38 lines
1import { Controller } from '../../../../../shared/infrastructure/http/Controller'; 2import { Request, Response } from 'express'; 3import { GetCollectionContributorsUseCase } from '../../../application/useCases/queries/GetCollectionContributorsUseCase'; 4 5export class GetCollectionContributorsController extends Controller { 6 constructor( 7 private getCollectionContributorsUseCase: GetCollectionContributorsUseCase, 8 ) { 9 super(); 10 } 11 12 async executeImpl(req: Request, res: Response): Promise<any> { 13 try { 14 const { collectionId } = req.params; 15 const { page, limit } = req.query; 16 const callingUserId = (req as any).did; 17 18 if (!collectionId) { 19 return this.fail(res, 'Collection ID is required'); 20 } 21 22 const result = await this.getCollectionContributorsUseCase.execute({ 23 collectionId, 24 callingUserId, 25 page: page ? parseInt(page as string) : undefined, 26 limit: limit ? parseInt(limit as string) : undefined, 27 }); 28 29 if (result.isErr()) { 30 return this.fail(res, result.error); 31 } 32 33 return this.ok(res, result.value); 34 } catch (error: any) { 35 return this.fail(res, error); 36 } 37 } 38}