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 / GetUserProfileController.ts
1.0 kB 33 lines
1import { Controller } from '../../../../../shared/infrastructure/http/Controller'; 2import { Response } from 'express'; 3import { AuthenticatedRequest } from '../../../../../shared/infrastructure/http/middleware/AuthMiddleware'; 4import { GetProfileUseCase } from '../../../application/useCases/queries/GetProfileUseCase'; 5 6export class GetUserProfileController extends Controller { 7 constructor(private getProfileUseCase: GetProfileUseCase) { 8 super(); 9 } 10 11 async executeImpl(req: AuthenticatedRequest, res: Response): Promise<any> { 12 try { 13 const { identifier } = req.params; 14 15 if (!identifier) { 16 return this.fail(res, 'Identifier (DID or handle) is required'); 17 } 18 19 const result = await this.getProfileUseCase.execute({ 20 userId: identifier, 21 callerDid: req.did, 22 }); 23 24 if (result.isErr()) { 25 return this.fail(res, result.error); 26 } 27 28 return this.ok(res, result.value); 29 } catch (error: any) { 30 return this.fail(res, error); 31 } 32 } 33}