-
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.
fix: Delete and integrate mission category (#140)
* fix: Deprecate MissionCategoryResponseDto * fix: Fix mission Category Response
- Loading branch information
Showing
8 changed files
with
182 additions
and
1 deletion.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/com/universe/uni/controller/MissionCategoryControllerV1.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,31 @@ | ||
package com.universe.uni.controller; | ||
|
||
import com.universe.uni.controller.docs.MissionControllerV1Contract; | ||
import com.universe.uni.dto.response.MissionCategoryWithContentsDto; | ||
import com.universe.uni.service.MissionService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/mission") | ||
public class MissionCategoryControllerV1 implements MissionControllerV1Contract { | ||
private final MissionService missionService; | ||
|
||
@GetMapping("/{missionCategoryId}") | ||
@ResponseStatus(HttpStatus.OK) | ||
@Override | ||
public MissionCategoryWithContentsDto getSelectedMissionCategory(@PathVariable Long missionCategoryId) { | ||
return missionService.getSelectedMissionCategory(missionCategoryId); | ||
} | ||
|
||
@GetMapping() | ||
@ResponseStatus(HttpStatus.OK) | ||
@Override | ||
public List<MissionCategoryWithContentsDto> getAllMissionCategories() { | ||
return missionService.getMissionCategories(); | ||
} | ||
} |
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
91 changes: 91 additions & 0 deletions
91
src/main/java/com/universe/uni/controller/docs/MissionControllerV1Contract.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,91 @@ | ||
package com.universe.uni.controller.docs; | ||
|
||
import com.universe.uni.dto.response.MissionCategoryResponseDto; | ||
import com.universe.uni.dto.response.MissionCategoryWithContentsDto; | ||
import com.universe.uni.exception.dto.ErrorResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.media.ArraySchema; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
||
import java.util.List; | ||
|
||
@Tag( | ||
name = "Mission", | ||
description = "사용자의 미션 관련 API 입니다." | ||
) | ||
public interface MissionControllerV1Contract { | ||
|
||
@Operation( | ||
summary = "미션 카테고리 상세 조회", | ||
description = "사용자는 미션 카테고리 아이디를 통해 상세 정보를 조회할 수 있다.", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "200", | ||
description = "성공", | ||
content = @Content( | ||
mediaType = MediaType.APPLICATION_JSON_VALUE, | ||
schema = @Schema(implementation = MissionCategoryResponseDto.class) | ||
) | ||
), | ||
@ApiResponse( | ||
responseCode = "404-UE5003", | ||
description = "존재하지 않는 미션 카테고리입니다", | ||
content = @Content( | ||
mediaType = MediaType.APPLICATION_JSON_VALUE, | ||
schema = @Schema(implementation = ErrorResponse.class) | ||
) | ||
), | ||
@ApiResponse( | ||
responseCode = "500-UE500", | ||
description = "서버 내부 오류입니다.", | ||
content = @Content( | ||
mediaType = MediaType.APPLICATION_JSON_VALUE, | ||
schema = @Schema(implementation = ErrorResponse.class) | ||
) | ||
) | ||
} | ||
) | ||
@GetMapping("/{missionCategoryId}") | ||
@ResponseStatus(HttpStatus.OK) | ||
MissionCategoryWithContentsDto getSelectedMissionCategory( | ||
@Parameter(required = true) | ||
@PathVariable Long missionCategoryId | ||
); | ||
|
||
@Operation( | ||
summary = "미션 카테고리 전체 조회", | ||
description = "사용자는 게임 생성시 미션의 모든 카테고리를 확인할 수 있다.", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "200", | ||
description = "성공", | ||
content = @Content( | ||
mediaType = MediaType.APPLICATION_JSON_VALUE, | ||
array = @ArraySchema( | ||
schema = @Schema(implementation = MissionCategoryResponseDto.class) | ||
) | ||
) | ||
), | ||
@ApiResponse( | ||
responseCode = "500-UE500", | ||
description = "서버 내부 오류입니다.", | ||
content = @Content( | ||
mediaType = MediaType.APPLICATION_JSON_VALUE, | ||
schema = @Schema(implementation = ErrorResponse.class) | ||
) | ||
) | ||
} | ||
) | ||
@GetMapping() | ||
@ResponseStatus(HttpStatus.OK) | ||
List<MissionCategoryWithContentsDto> getAllMissionCategories(); | ||
} |
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
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
src/main/java/com/universe/uni/dto/response/MissionCategoryWithContentsDto.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.universe.uni.dto.response; | ||
|
||
import com.universe.uni.domain.entity.MissionCategory; | ||
import com.universe.uni.dto.MissionContentDto; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
|
||
import java.util.List; | ||
|
||
@Schema(description = "미션 카테고리 정보 DTO") | ||
@Getter | ||
public class MissionCategoryWithContentsDto extends MissionCategoryDto { | ||
|
||
private final List<MissionContentDto> missionContentsDto; | ||
|
||
public MissionCategoryWithContentsDto( | ||
MissionCategory missionCategory, | ||
List<MissionContentDto> missionContentsDto | ||
) { | ||
super(missionCategory); | ||
this.missionContentsDto = missionContentsDto; | ||
} | ||
} |
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