Rename some API object and add update user to UserPoint. However, it seems to be broken somehow

This commit is contained in:
araemer 2025-11-13 21:32:27 +01:00
parent 81f1c3668b
commit a9bd803112
12 changed files with 143 additions and 41 deletions

View file

@ -2,8 +2,8 @@ import { UserRepository } from "../repositories/UserRepository.js";
import { encrypt } from "../utils/encryptionUtils.js";
import { ValidationError, UnauthorizedError } from "../errors/httpErrors.js";
import { UserDtoEntityMapper } from "../mappers/UserDtoEntityMapper.js";
import { LoginResponseDto } from "../dtos/LoginResponseDto.js";
import { LoginRequestDto } from "../dtos/LoginRequestDto.js";
import { LoginResponse } from "../dtos/LoginResponse.js";
import { LoginRequest } from "../dtos/LoginRequest.js";
/**
* Controller responsible for authentication, e.g., login or issueing a token with extended
@ -17,10 +17,10 @@ export class AuthHandler {
/**
* Login: Check user and password and generate token
* @param loginRequest LoginRequestDto containing userName and password for login
* @param loginRequest LoginRequest containing userName and password for login
* @returns LoginResponse containing token and user data for the user who just logged in
*/
async login(loginRequest : LoginRequestDto): Promise<LoginResponseDto> {
async login(loginRequest : LoginRequest): Promise<LoginResponse> {
const userName :string|undefined = loginRequest.userName;
const password :string|undefined = loginRequest.password;
console.log("user", userName, " is trying to log in")
@ -50,7 +50,7 @@ export class AuthHandler {
id: userId!, // ! to indicate that we've definitely checked for userId being defined
});
const responseDto = new LoginResponseDto();
const responseDto = new LoginResponse();
responseDto.userData = this.mapper.toDto(user);
responseDto.token = tokenInfo.token;
responseDto.expiryDate = tokenInfo.expiryDate;