Skip to content

Commit

Permalink
Merge pull request #7 from yscarlet/main
Browse files Browse the repository at this point in the history
stop 추가
  • Loading branch information
yunuo46 authored May 9, 2024
2 parents f0f38cb + 514bc36 commit 4cad346
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package getaguitar.site.demo.Controller;

import getaguitar.site.demo.Dto.ResStopUserDto;
import getaguitar.site.demo.Dto.ReqStopUserDto;
import getaguitar.site.demo.Dto.Player;
import getaguitar.site.demo.Dto.NewUser.ReqNewUserDto;
import getaguitar.site.demo.Dto.NewUser.ResNewUserDto;
import getaguitar.site.demo.Service.MapService;

import lombok.RequiredArgsConstructor;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.Payload;
Expand Down Expand Up @@ -40,6 +43,8 @@ public Player[] allUser(){

@MessageMapping("/stop")
@SendTo("/topic/map/stop")
public void stopUser() {
public ResStopUserDto stopUser(ReqStopUserDto stopUser) {
ResStopUserDto resStopUserDto= mapService.stopUser(stopUser);
return resStopUserDto;
}
}
14 changes: 14 additions & 0 deletions src/main/java/getaguitar/site/demo/Dto/ReqStopUserDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package getaguitar.site.demo.Dto;

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

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class ReqStopUserDto {
private String username;
}
16 changes: 16 additions & 0 deletions src/main/java/getaguitar/site/demo/Dto/ResStopUserDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package getaguitar.site.demo.Dto;

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

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class ResStopUserDto {
private String id;
private int x;
private int y;
}
3 changes: 3 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,11 @@
package getaguitar.site.demo.Service;

import getaguitar.site.demo.Dto.ReqStopUserDto;
import getaguitar.site.demo.Dto.ResStopUserDto;
import getaguitar.site.demo.Dto.NewUser.ReqNewUserDto;
import getaguitar.site.demo.Dto.NewUser.ResNewUserDto;

public interface MapService {
ResNewUserDto createUser(ReqNewUserDto newUser);
ResStopUserDto stopUser(ReqStopUserDto stopUser);
}
10 changes: 10 additions & 0 deletions src/main/java/getaguitar/site/demo/Service/MapServiceImpl.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package getaguitar.site.demo.Service;

import getaguitar.site.demo.Dto.ReqStopUserDto;
import getaguitar.site.demo.Dto.ResStopUserDto;

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

import org.springframework.stereotype.Service;

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

public ResStopUserDto stopUser(ReqStopUserDto stopUser){
ResStopUserDto resStopUserDto = new ResStopUserDto("testId", 0, 0);
return resStopUserDto;
}
}

0 comments on commit 4cad346

Please sign in to comment.