-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from pknu-wap/feature/49-feat-스테이지4-진행-상황-기능
Feature/49 feat 스테이지4 진행 상황 기능
- Loading branch information
Showing
15 changed files
with
616 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
sever/src/main/java/com/example/rememberdokdo/Dto/Stage4ItemDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.example.rememberdokdo.Dto; | ||
|
||
import com.example.rememberdokdo.Entity.Stage4ItemEntity; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Stage4ItemDto { | ||
|
||
private String itemName; // 아이템 이름 | ||
private String itemDescription; // 아이템 설명 | ||
private boolean isCorrectItem; // 정답 여부 | ||
|
||
// Entity -> DTO 변환 | ||
public static Stage4ItemDto fromEntity(Stage4ItemEntity entity) { | ||
return new Stage4ItemDto( | ||
entity.getItemName(), | ||
entity.getItemDescription(), | ||
entity.isCorrectItem() // 정답 여부 | ||
); | ||
} | ||
|
||
// DTO -> Entity 변환 | ||
public Stage4ItemEntity toEntity() { | ||
return Stage4ItemEntity.builder() | ||
.itemName(this.itemName) | ||
.itemDescription(this.itemDescription) | ||
.isCorrectItem(this.isCorrectItem) | ||
.build(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
sever/src/main/java/com/example/rememberdokdo/Dto/StageProgressResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.example.rememberdokdo.Dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class StageProgressResponseDto { | ||
private Integer progressId; // 진행 상태 ID | ||
private String sessionId; // 세션 ID | ||
private int remainingHearts; // 남은 하트 | ||
private boolean isCleared; // 스테이지 클리어 여부 | ||
} |
17 changes: 17 additions & 0 deletions
17
sever/src/main/java/com/example/rememberdokdo/Dto/StageResetResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.example.rememberdokdo.Dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor // 생성자 | ||
@Builder | ||
public class StageResetResponseDto { | ||
private int progressId; | ||
private String sessionId; | ||
private String message; // 게임 클리어 여부 메시지 | ||
} | ||
|
32 changes: 32 additions & 0 deletions
32
sever/src/main/java/com/example/rememberdokdo/Entity/Stage4ItemEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.example.rememberdokdo.Entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
@Table(name = "Stage4Item") | ||
public class Stage4ItemEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private int itemId; // 아이템 ID (Primary Key) | ||
|
||
@Column(nullable = false) | ||
private String itemName; // 아이템 이름 | ||
|
||
@Column(length = 500) | ||
private String itemDescription; // 아이템 설명 | ||
|
||
@Column(nullable = false) | ||
private int relatedMissionId; // 관련된 미션 ID | ||
|
||
@Column(nullable = false) | ||
private boolean isCorrectItem; // 정답 여부 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
sever/src/main/java/com/example/rememberdokdo/Exception/StageExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.example.rememberdokdo.Exception; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
import java.util.Map; | ||
|
||
@RestControllerAdvice | ||
public class StageExceptionHandler { | ||
|
||
@ExceptionHandler(IllegalStateException.class) | ||
@ResponseStatus(HttpStatus.BAD_REQUEST) | ||
public Map<String, String> handleIllegalStateException(IllegalStateException ex) { | ||
return Map.of("error", ex.getMessage()); | ||
} | ||
|
||
// 기타 예외 처리 | ||
@ExceptionHandler(Exception.class) | ||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) | ||
public Map<String, String> handleGeneralException(Exception ex) { | ||
return Map.of("error", "서버 오류가 발생했습니다.", "details", ex.getMessage()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
sever/src/main/java/com/example/rememberdokdo/Repository/Stage4ItemRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.example.rememberdokdo.Repository; | ||
|
||
import com.example.rememberdokdo.Entity.Stage4ItemEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface Stage4ItemRepository extends JpaRepository<Stage4ItemEntity, Integer> { | ||
|
||
// 특정 미션 ID와 아이템 이름으로 아이템 검색 | ||
Optional<Stage4ItemEntity> findByRelatedMissionIdAndItemName(int relatedMissionId, String itemName); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.