-
Notifications
You must be signed in to change notification settings - Fork 2
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 #190 from Team-HMH/develop
develop -> main
- Loading branch information
Showing
60 changed files
with
1,104 additions
and
287 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
59 changes: 59 additions & 0 deletions
59
src/main/java/sopt/org/hmh/domain/app/controller/ChallengeAppApi.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,59 @@ | ||
package sopt.org.hmh.domain.app.controller; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
import sopt.org.hmh.domain.app.dto.request.AppRemoveRequest; | ||
import sopt.org.hmh.domain.app.dto.request.ChallengeAppArrayRequest; | ||
import sopt.org.hmh.global.auth.jwt.JwtConstants; | ||
import sopt.org.hmh.global.common.response.BaseResponse; | ||
import sopt.org.hmh.global.common.response.EmptyJsonResponse; | ||
|
||
@Tag(name = "챌린지 관련 API") | ||
@SecurityRequirement(name = JwtConstants.AUTHORIZATION) | ||
public interface ChallengeAppApi { | ||
|
||
@Operation( | ||
summary = "스크린타임 설정할 앱을 추가하는 API", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "200", | ||
description = "챌린지 정보 조회에 성공했습니다."), | ||
@ApiResponse( | ||
responseCode = "400", | ||
description = "잘못된 요청입니다.", | ||
content = @Content), | ||
@ApiResponse( | ||
responseCode = "500", | ||
description = "서버 내부 오류입니다.", | ||
content = @Content)}) | ||
ResponseEntity<BaseResponse<EmptyJsonResponse>> orderAddApps( | ||
@Parameter(hidden = true) Long userId, | ||
@RequestHeader("OS") String os, | ||
@RequestBody ChallengeAppArrayRequest requests); | ||
|
||
@Operation( | ||
summary = "스크린타임 설정한 앱을 삭제하는 API", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "200", | ||
description = "챌린지 정보 조회에 성공했습니다."), | ||
@ApiResponse( | ||
responseCode = "400", | ||
description = "잘못된 요청입니다.", | ||
content = @Content), | ||
@ApiResponse( | ||
responseCode = "500", | ||
description = "서버 내부 오류입니다.", | ||
content = @Content)}) | ||
ResponseEntity<BaseResponse<EmptyJsonResponse>> orderRemoveApp( | ||
@Parameter(hidden = true) Long userId, | ||
@RequestHeader("OS") String os, | ||
@RequestBody AppRemoveRequest request); | ||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/sopt/org/hmh/domain/app/controller/ChallengeAppController.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,54 @@ | ||
package sopt.org.hmh.domain.app.controller; | ||
|
||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import sopt.org.hmh.domain.app.domain.exception.AppSuccess; | ||
import sopt.org.hmh.domain.app.dto.request.AppRemoveRequest; | ||
import sopt.org.hmh.domain.app.dto.request.ChallengeAppArrayRequest; | ||
import sopt.org.hmh.domain.challenge.service.ChallengeFacade; | ||
import sopt.org.hmh.global.auth.UserId; | ||
import sopt.org.hmh.global.common.constant.CustomHeaderType; | ||
import sopt.org.hmh.global.common.response.BaseResponse; | ||
import sopt.org.hmh.global.common.response.EmptyJsonResponse; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/challenge/app") | ||
public class ChallengeAppController implements ChallengeAppApi { | ||
|
||
private final ChallengeFacade challengeFacade; | ||
|
||
@Override | ||
@PostMapping | ||
public ResponseEntity<BaseResponse<EmptyJsonResponse>> orderAddApps( | ||
@UserId final Long userId, | ||
@RequestHeader(CustomHeaderType.OS) final String os, | ||
@RequestBody @Valid final ChallengeAppArrayRequest requests) { | ||
challengeFacade.addAppsToCurrentChallenge(userId, requests.apps(), os); | ||
|
||
return ResponseEntity | ||
.status(AppSuccess.ADD_APP_SUCCESS.getHttpStatus()) | ||
.body(BaseResponse.success(AppSuccess.ADD_APP_SUCCESS, new EmptyJsonResponse())); | ||
|
||
} | ||
|
||
@Override | ||
@DeleteMapping | ||
public ResponseEntity<BaseResponse<EmptyJsonResponse>> orderRemoveApp( | ||
@UserId final Long userId, | ||
@RequestHeader(CustomHeaderType.OS) final String os, | ||
@RequestBody @Valid final AppRemoveRequest request) { | ||
challengeFacade.removeAppFromCurrentChallenge(userId, request.appCode(), os); | ||
|
||
return ResponseEntity | ||
.status(AppSuccess.REMOVE_APP_SUCCESS.getHttpStatus()) | ||
.body(BaseResponse.success(AppSuccess.REMOVE_APP_SUCCESS, new EmptyJsonResponse())); | ||
} | ||
} |
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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/sopt/org/hmh/domain/auth/dto/response/LoginResponse.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
2 changes: 1 addition & 1 deletion
2
src/main/java/sopt/org/hmh/domain/auth/dto/response/ReissueResponse.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
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.