diff --git a/src/main/java/getaguitar/site/demo/Controller/MapController.java b/src/main/java/getaguitar/site/demo/Controller/MapController.java index 89561a6..b477e1e 100644 --- a/src/main/java/getaguitar/site/demo/Controller/MapController.java +++ b/src/main/java/getaguitar/site/demo/Controller/MapController.java @@ -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; @@ -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") diff --git a/src/main/java/getaguitar/site/demo/Dto/ResMoveUserDto.java b/src/main/java/getaguitar/site/demo/Dto/ResMoveUserDto.java new file mode 100644 index 0000000..1492e41 --- /dev/null +++ b/src/main/java/getaguitar/site/demo/Dto/ResMoveUserDto.java @@ -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; +} diff --git a/src/main/java/getaguitar/site/demo/Service/MapService.java b/src/main/java/getaguitar/site/demo/Service/MapService.java index 7ddbdc1..5a45b26 100644 --- a/src/main/java/getaguitar/site/demo/Service/MapService.java +++ b/src/main/java/getaguitar/site/demo/Service/MapService.java @@ -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); } diff --git a/src/main/java/getaguitar/site/demo/Service/MapServiceImpl.java b/src/main/java/getaguitar/site/demo/Service/MapServiceImpl.java index 21cf390..38ed4bc 100644 --- a/src/main/java/getaguitar/site/demo/Service/MapServiceImpl.java +++ b/src/main/java/getaguitar/site/demo/Service/MapServiceImpl.java @@ -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; @@ -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; + } + }