Skip to content

Commit

Permalink
✨ :: 유저 도메인 컬럼 수정, 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
lgwk42 committed Jul 17, 2024
1 parent d33178a commit 27ab33e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.project.pieceserver.domain.user.client.dto.User;
import com.project.pieceserver.domain.user.client.dto.request.NameEditRequest;
import com.project.pieceserver.domain.user.domain.repository.jpa.UserRepository;
import com.project.pieceserver.domain.user.domain.repository.jpa.UserSecurity;
import com.project.pieceserver.global.common.repository.UserSecurity;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand All @@ -16,9 +16,6 @@ public class UserService {
private final User userDTO;

public void editUserName(NameEditRequest request) {

// User user = new User();
// User user = userUtil.
User user = userRepository
.findByEmail(userSecurity.getUser().getEmail())
.map(userDTO::toUser)
Expand All @@ -27,5 +24,4 @@ public void editUserName(NameEditRequest request) {
userRepository.save(user.toEntity(user));
}


}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.project.pieceserver.domain.user.client.dto;

import com.project.pieceserver.domain.user.domain.entity.UserEntity;
import com.project.pieceserver.domain.user.domain.enums.UserRole;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -20,13 +21,15 @@ public class User {
private String password;
private String name;
private String birth;
private UserRole userRole;

public UserEntity toEntity(User user){
return UserEntity.builder()
.email(user.getEmail())
.password(user.getPassword())
.name(user.getName())
.birth(user.getBirth())
.userRole(UserRole.USER)
.build();
}

Expand All @@ -36,6 +39,7 @@ public User toUser(UserEntity userEntity){
.password(userEntity.getPassword())
.name(userEntity.getName())
.birth(userEntity.getBirth())
.userRole(userEntity.getUserRole())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.project.pieceserver.domain.user.domain.entity;

import com.project.pieceserver.domain.user.domain.enums.UserRole;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AccessLevel;
Expand Down Expand Up @@ -29,4 +32,11 @@ public class UserEntity {
@Column(nullable = false)
private String birth;

@Column(nullable = false)
private int point;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private UserRole userRole;

}

0 comments on commit 27ab33e

Please sign in to comment.