A social knowledge tool for researchers built on ATProto
1import { Controller } from '../../../../../shared/infrastructure/http/Controller'; 2import { Response } from 'express'; 3import { GetProfileUseCase } from '../../../application/useCases/queries/GetProfileUseCase'; 4import { AuthenticatedRequest } from '../../../../../shared/infrastructure/http/middleware/AuthMiddleware'; 5 6export class GetMyProfileController extends Controller { 7 constructor(private getProfileUseCase: GetProfileUseCase) { 8 super(); 9 } 10 11 async executeImpl(req: AuthenticatedRequest, res: Response): Promise<any> { 12 try { 13 const userId = req.did; 14 15 if (!userId) { 16 return this.unauthorized(res); 17 } 18 19 const result = await this.getProfileUseCase.execute({ userId }); 20 21 if (result.isErr()) { 22 return this.fail(res, result.error); 23 } 24 25 return this.ok(res, result.value); 26 } catch (error: any) { 27 return this.fail(res, error); 28 } 29 } 30}