Created
February 17, 2020 11:17
-
-
Save QuadradS/d6be891537a947e7b0a4815d96cd587e to your computer and use it in GitHub Desktop.
Controllers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Autowired, BaseController, GetMapping, PatchMapping, RequestBody, RestController, User } from 'ts-framework' | |
import Injectables from '../enums/injectables' | |
import Paths from '../enums/paths' | |
import { AuthJwtPayloadDTO, ChangePasswordByRecoveryTokenDTO, UserResponseDTO } from 'goin-shared' | |
import { UserService } from '../services' | |
@RestController | |
class UserController extends BaseController { | |
private userService: UserService | |
@Autowired(Injectables.services.user) | |
setUserService(userService: UserService) { | |
this.userService = userService | |
} | |
@GetMapping(Paths.user.mobileGetCurrentUser) | |
protected loginByCredentials(@User() authJwtPayload: AuthJwtPayloadDTO): Promise<UserResponseDTO> { | |
return this.userService.getCurrentUser(authJwtPayload) | |
} | |
@PatchMapping(Paths.user.changePasswordByRecoveryToken) | |
protected changePasswordByRecoveryToken( | |
@RequestBody(ChangePasswordByRecoveryTokenDTO) dto: ChangePasswordByRecoveryTokenDTO | |
): Promise<void> { | |
return this.userService.updateUserPasswordByRecoveryToken(dto) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment