Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { AppMessage, AppUser, AppUserLoginCredentials, AppUserLogoutCredentials } from '@app/backend-interfaces';
import { Body, Controller, Get, Inject, Post } from '@nestjs/common';
import type { IAuthService } from '../interfaces/auth.interface';
import { AUTH_SERVICE_TOKEN } from '../services/auth.service';
@Controller({
path: 'auth',
})
export class AppAuthController {
constructor(@Inject(AUTH_SERVICE_TOKEN) private readonly authService: IAuthService) {}
@Get('')
public ping(): AppMessage {
return this.authService.ping();
}
@Post('login')
public login(@Body() credentials: AppUserLoginCredentials): AppUser {
return this.authService.login(credentials);
}
@Post('logout')
public logout(@Body() credentials: AppUserLogoutCredentials): AppMessage {
return this.authService.logout(credentials);
}
@Post('signup')
public signup(@Body() credentials: AppUserLoginCredentials): AppUser {
return this.authService.signup(credentials);
}
}
|