Skip to content

Commit

Permalink
moveUser
Browse files Browse the repository at this point in the history
  • Loading branch information
YunbinGil committed May 8, 2024
1 parent 2c181e9 commit ccc5e0e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package getaguitar.site.demo.Controller;

import getaguitar.site.demo.Dto.ReqNewUserDto;
import getaguitar.site.demo.Dto.ResMoveUserDto;
import getaguitar.site.demo.Dto.ResNewUserDto;
import getaguitar.site.demo.Service.MapService;
import lombok.RequiredArgsConstructor;
Expand All @@ -18,8 +19,9 @@ public class MapController {

@MessageMapping("/move")
@SendTo("/topic/map/move")
public void moveUser() {
//mapService.move();
public ResMoveUserDto moveUser(String direction) {
ResMoveUserDto resMoveUserDto = mapService.moveUser(direction);
return resMoveUserDto;
}

@MessageMapping("/new")
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/getaguitar/site/demo/Dto/ResMoveUserDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package getaguitar.site.demo.Dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class ResMoveUserDto {
private Object id;
private int x;
private int y;
private String direction;
}
2 changes: 2 additions & 0 deletions src/main/java/getaguitar/site/demo/Service/MapService.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package getaguitar.site.demo.Service;

import getaguitar.site.demo.Dto.ReqNewUserDto;
import getaguitar.site.demo.Dto.ResMoveUserDto;
import getaguitar.site.demo.Dto.ResNewUserDto;

public interface MapService {
ResNewUserDto createUser(ReqNewUserDto newUser);
ResMoveUserDto moveUser(String direction);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package getaguitar.site.demo.Service;
import getaguitar.site.demo.Dto.ReqNewUserDto;
import getaguitar.site.demo.Dto.ResMoveUserDto;
import getaguitar.site.demo.Dto.ResNewUserDto;
import org.springframework.stereotype.Service;

Expand All @@ -10,4 +11,11 @@ public ResNewUserDto createUser(ReqNewUserDto newUser){
ResNewUserDto resNewUserDto = new ResNewUserDto("testId",0,0,"down");
return resNewUserDto;
}

@Override
public ResMoveUserDto moveUser(String direction) {
ResMoveUserDto moveUserDto = new ResMoveUserDto("testId", 1, 1, direction);
return moveUserDto;
}

}

0 comments on commit ccc5e0e

Please sign in to comment.