A social knowledge tool for researchers built on ATProto
at main 27 lines 839 B view raw
1import { Controller } from '../../../../../shared/infrastructure/http/Controller'; 2import { Request, Response } from 'express'; 3import { InitiateOAuthSignInUseCase } from '../../../application/use-cases/InitiateOAuthSignInUseCase'; 4 5export class InitiateOAuthSignInController extends Controller { 6 constructor(private initiateOAuthSignInUseCase: InitiateOAuthSignInUseCase) { 7 super(); 8 } 9 10 async executeImpl(req: Request, res: Response): Promise<any> { 11 try { 12 const { handle } = req.query; 13 14 const result = await this.initiateOAuthSignInUseCase.execute({ 15 handle: handle as string | undefined, 16 }); 17 18 if (result.isErr()) { 19 return this.fail(res, result.error.message); 20 } 21 22 return this.ok(res, result.value); 23 } catch (error: any) { 24 return this.fail(res, error); 25 } 26 } 27}