Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIx] 엔티티 변경 #75

Merged
merged 4 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions infra/sql/user.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ CREATE TABLE map_user (
rotation_yaw DOUBLE NOT NULL,
rotation_roll DOUBLE NOT NULL,
status VARCHAR(50) NOT NULL,
aurora INT NOT NULL,
title INT NOT NULL,
velocity_x DOUBLE NOT NULL,
velocity_y DOUBLE NOT NULL,
velocity_z DOUBLE NOT NULL,
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/kutaverse/game/map/domain/Status.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package kutaverse.game.map.domain;

public enum Status {
JUMP,STAND,NOTUSE
JUMP,
STAND,
NOTUSE,
KICK_BOARD,
;
}
9 changes: 8 additions & 1 deletion src/main/java/kutaverse/game/map/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public class User {

private Status status;

private int aurora; //오로라

private int title; //칭호

private Double velocityX;

private Double velocityY;
Expand All @@ -53,7 +57,8 @@ public class User {
@Builder
public User(String userId, Double positionX, Double positionY, Double positionZ,
Double rotationPitch, Double rotationYaw, Double rotationRoll,
Double velocityX, Double velocityY, Double velocityZ, Status status) {
Double velocityX, Double velocityY, Double velocityZ, Status status,
int aurora, int title) {
this.userId = userId;
this.positionX = Math.round(positionX*1000.0)/1000.0;
this.positionY = Math.round(positionY*1000.0)/1000.0;;
Expand All @@ -62,6 +67,8 @@ public User(String userId, Double positionX, Double positionY, Double positionZ,
this.rotationYaw = Math.round(rotationYaw*1000.0)/1000.0;
this.rotationRoll = Math.round(rotationRoll*1000.0)/1000.0;
this.status = status;
this.aurora=aurora;
this.title=title;
this.velocityX = Math.round(velocityX*1000.0)/1000.0;
this.velocityY = Math.round(velocityY*1000.0)/1000.0;;
this.velocityZ = Math.round(velocityZ*1000.0)/1000.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class UserRequestDto {
private Double velocityY;
private Double velocityZ;
private Status status;
private int aurora; //오로라
private int title; //칭호

public User toEntity(){
return User.builder()
Expand All @@ -37,6 +39,8 @@ public User toEntity(){
.velocityY(velocityZ)
.velocityZ(velocityZ)
.status(status)
.aurora(aurora)
.title(title)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class UserResponseDto {
private Double velocityY;
private Double velocityZ;
private Status status;
private int aurora; //오로라
private int title; //칭호

/*public UserResponseDto(User user) {
this.userId = user.getUserId();
Expand Down Expand Up @@ -54,6 +56,8 @@ public static UserResponseDto toDto(User user){
.velocityY(user.getVelocityY())
.velocityZ(user.getVelocityZ())
.status(user.getStatus())
.aurora(user.getAurora())
.title(user.getTitle())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public class MapWebsocketTest {
@Autowired
UserCashRepository userCashRepository;

User user1=new User("1",2.1,1.1,1.1,1.1,1.1,1.1,1.1,1.1,1.1, Status.JUMP);
User user2=new User("2",1.1,1.1,1.1,1.1,1.1,1.1,2.2,2.2,2.2, Status.STAND);
User user1=new User("1",2.1,1.1,1.1,1.1,1.1,1.1,1.1,1.1,1.1, Status.JUMP,1,1);
User user2=new User("2",1.1,1.1,1.1,1.1,1.1,1.1,2.2,2.2,2.2, Status.STAND,1,1);

UserResponseDto userResponseDto1=UserResponseDto.toDto(user1);
UserResponseDto userResponseDto2=UserResponseDto.toDto(user2);
Expand Down Expand Up @@ -90,7 +90,7 @@ public void test1() throws URISyntaxException {
public void test2() throws URISyntaxException {
userCashRepository.delete(user1.getUserId()).block();
userCashRepository.delete(user2.getUserId()).block();
User notUseUser = new User("2", 1.1, 1.1, 1.1, 1.1, 1.1, 1.1,1.1,1.1,1.1, Status.NOTUSE);
User notUseUser = new User("2", 1.1, 1.1, 1.1, 1.1, 1.1, 1.1,1.1,1.1,1.1, Status.NOTUSE,1,1);
userCashRepository.add(notUseUser).block();

int connectionTimeSecond=1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class UserControllerTest {
@Autowired
UserCashRepository userCashRepository;

User user1=new User("1",2.1,1.1,1.1,1.1,1.1,1.1,1.1,1.1,1.1, Status.JUMP);
User user2=new User("2",1.1,1.1,1.1,1.1,1.1,1.1,2.2,2.2,2.2, Status.STAND);
User user1=new User("1",2.1,1.1,1.1,1.1,1.1,1.1,1.1,1.1,1.1, Status.JUMP,1,1);
User user2=new User("2",1.1,1.1,1.1,1.1,1.1,1.1,2.2,2.2,2.2, Status.STAND,1,1);
GetMapUserResponse userResponse1=GetMapUserResponse.toDto(user1);

@PostConstruct
Expand Down Expand Up @@ -84,7 +84,7 @@ public void test2(){
@DisplayName("post 요청으로 db에 저장할 수 있다.")
public void test3(){
webTestClient = WebTestClient.bindToApplicationContext(applicationContext).configureClient().responseTimeout(Duration.ofHours(1)).build();
User user3=new User("3",1.234,2.345,3.4567,1.1,1.1,1.1,1.1,1.1,1.1, Status.NOTUSE);
User user3=new User("3",1.234,2.345,3.4567,1.1,1.1,1.1,1.1,1.1,1.1, Status.NOTUSE,1,1);
PostMapUserRequest postMapUserRequest=PostMapUserRequest.toEntity(user3);
PostMapUserResponse postMapUserResponse=PostMapUserResponse.toDto(user3);
webTestClient.post()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public class UserRepositoryTest {
@Autowired
private UserRepository userRepository;

User user = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND);
User user1 = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND);
User user2 = new User("2", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND);
User user = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND,1,1);
User user1 = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND,1,1);
User user2 = new User("2", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND,1,1);


@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public class UserControllerImplAPITest {
@MockBean
UserCashService userService;

User user = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND);
User user1 = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND);
User user2 = new User("2", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND);
User user = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND,1,1);
User user1 = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND,1,1);
User user2 = new User("2", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND,1,1);
PostMapUserRequest postMapUserRequest = PostMapUserRequest.toEntity(user);
PostMapUserResponse postMapUserResponse = PostMapUserResponse.toDto(user);
GetMapUserResponse getMapUserResponse = GetMapUserResponse.toDto(user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class UserControllerImplTest {
@Autowired
UserController userController;

User user = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND);
User user = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND,1,1);
PostMapUserRequest postMapUserRequest = PostMapUserRequest.toEntity(user);
PostMapUserResponse postMapUserResponse = PostMapUserResponse.toDto(user);
GetMapUserResponse getMapUserResponse = GetMapUserResponse.toDto(user);
Expand Down Expand Up @@ -81,8 +81,8 @@ public void test2() {
public void test3() {
//given

User user1 = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND);
User user2 = new User("2", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND);
User user1 = new User("1", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND,1,1);
User user2 = new User("2", 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, Status.STAND,1,1);
GetMapUserResponse getMapUserResponse1 = GetMapUserResponse.toDto(user1);
GetMapUserResponse getMapUserResponse2 = GetMapUserResponse.toDto(user2);

Expand Down
Loading