refactor
All checks were successful
CI / eslint (pull_request) Successful in 22s
CI / prettier (pull_request) Successful in 21s
CI / test-build (pull_request) Successful in 40s

This commit is contained in:
Constantin Simonis 2025-02-19 11:41:17 +01:00
parent 8d8adafcd3
commit 4fcf5d8547
Signed by: csimonis
GPG Key ID: 758DD9C506603183
2 changed files with 10 additions and 6 deletions

View File

@ -4,12 +4,15 @@ import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Setter
@Getter
@Entity
@NoArgsConstructor
public class UserEntity {
@Id
@GeneratedValue
@ -18,4 +21,10 @@ public class UserEntity {
private String keycloakId;
private String username;
private float balance;
public UserEntity(String keycloakId, String username, float balance) {
this.keycloakId = keycloakId;
this.username = username;
this.balance = balance;
}
}

View File

@ -11,12 +11,7 @@ public class UserMappingService {
}
public UserEntity mapToUserEntity(CreateUserDto createUserDto) {
UserEntity user = new UserEntity();
user.setKeycloakId(createUserDto.getKeycloakId());
user.setUsername(createUserDto.getUsername());
user.setBalance(0);
return user;
return new UserEntity(createUserDto.getUsername(), createUserDto.getKeycloakId(), 0);
}
}