presenter refactoring
This commit is contained in:
@@ -8,22 +8,26 @@ export class AuthController {
|
||||
|
||||
@Post('signup')
|
||||
async signup(@Body() params: SignupParams): Promise<AuthSessionDTO> {
|
||||
return this.authService.signupWithEmail(params);
|
||||
const presenter = await this.authService.signupWithEmail(params);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Post('login')
|
||||
async login(@Body() params: LoginParams): Promise<AuthSessionDTO> {
|
||||
return this.authService.loginWithEmail(params);
|
||||
const presenter = await this.authService.loginWithEmail(params);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Get('session')
|
||||
async getSession(): Promise<AuthSessionDTO | null> {
|
||||
return this.authService.getCurrentSession();
|
||||
const presenter = await this.authService.getCurrentSession();
|
||||
return presenter ? presenter.viewModel : null;
|
||||
}
|
||||
|
||||
@Post('logout')
|
||||
async logout(): Promise<void> {
|
||||
return this.authService.logout();
|
||||
async logout(): Promise<{ success: boolean }> {
|
||||
const presenter = await this.authService.logout();
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user