-
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 #115 from Open-Eye-Im-Developer/develop
[MERGE] develop 을 main 에 반영
- Loading branch information
Showing
41 changed files
with
557 additions
and
91 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
47 changes: 47 additions & 0 deletions
47
src/main/java/io/oeid/mogakgo/common/swagger/template/MatchingSwagger.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,47 @@ | ||
package io.oeid.mogakgo.common.swagger.template; | ||
|
||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerMatchingErrorExamples; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerProjectErrorExamples; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerUserErrorExamples; | ||
import io.oeid.mogakgo.domain.matching.presentation.dto.MatchingId; | ||
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.media.ExampleObject; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
@Tag(name = "Matching", description = "매칭 관련 API") | ||
@SuppressWarnings("unused") | ||
public interface MatchingSwagger { | ||
|
||
@Operation(summary = "매칭 취소", description = "회원이 현재 진행 중인 매칭을 취소할때 사용하는 API") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "매칭 취소 완료"), | ||
@ApiResponse(responseCode = "400", description = "매칭을 취소할 수 없는 상태임", | ||
content = @Content( | ||
mediaType = "application/json", | ||
examples = { | ||
@ExampleObject(name = "E090101", value = SwaggerMatchingErrorExamples.MATCHING_CANCEL_NOT_ALLOWED), | ||
@ExampleObject(name = "E030110", value = SwaggerProjectErrorExamples.INVALID_PROJECT_STATUS_TO_FINISH) | ||
})), | ||
@ApiResponse(responseCode = "403", description = "요청을 보낸 사람이 매칭 취소할 권한이 안됨 (매칭 참여자가 아님)", | ||
content = @Content( | ||
mediaType = "application/json", | ||
examples = @ExampleObject(name = "E090201", value = SwaggerMatchingErrorExamples.MATCHING_FORBIDDEN_OPERATION))), | ||
@ApiResponse(responseCode = "404", description = "요청한 데이터가 존재하지 않음", | ||
content = @Content( | ||
mediaType = "application/json", | ||
examples = { | ||
@ExampleObject(name = "E090201", value = SwaggerMatchingErrorExamples.MATCHING_NOT_FOUND), | ||
@ExampleObject(name = "E020301", value = SwaggerUserErrorExamples.USER_NOT_FOUND) | ||
})), | ||
}) | ||
ResponseEntity<MatchingId> cancel( | ||
@Parameter(hidden = true) Long userId, | ||
@Parameter(description = "매칭 ID", required = true) Long matchingId | ||
); | ||
|
||
} |
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
9 changes: 9 additions & 0 deletions
9
...main/java/io/oeid/mogakgo/core/properties/swagger/error/SwaggerMatchingErrorExamples.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,9 @@ | ||
package io.oeid.mogakgo.core.properties.swagger.error; | ||
|
||
public class SwaggerMatchingErrorExamples { | ||
|
||
public static final String MATCHING_CANCEL_NOT_ALLOWED = "{\"timestamp\":\"2024-02-17T10:07:31.404Z\",\"statusCode\":400,\"code\":\"E090101\",\"message\":\"이미 취소 되었거나 종료된 매칭은 취소할 수 없습니다.\"}"; | ||
public static final String MATCHING_NOT_FOUND = "{\"timestamp\":\"2024-02-17T10:07:31.404Z\",\"statusCode\":404,\"code\":\"E090301\",\"message\":\"해당 매칭이 존재하지 않습니다.\"}"; | ||
public static final String MATCHING_FORBIDDEN_OPERATION = "{\"timestamp\":\"2024-02-17T10:07:31.404Z\",\"statusCode\":403,\"code\":\"E090201\",\"message\":\"해당 매칭에 대한 권한이 없습니다.\"}"; | ||
|
||
} |
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
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
25 changes: 22 additions & 3 deletions
25
src/main/java/io/oeid/mogakgo/domain/matching/domain/entity/enums/MatchingStatus.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 |
---|---|---|
@@ -1,7 +1,26 @@ | ||
package io.oeid.mogakgo.domain.matching.domain.entity.enums; | ||
|
||
import static io.oeid.mogakgo.exception.code.ErrorCode400.MATCHING_CANCEL_NOT_ALLOWED; | ||
|
||
import io.oeid.mogakgo.domain.matching.exception.MatchingException; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum MatchingStatus { | ||
PROGRESS, | ||
CANCELED, | ||
FINISHED | ||
PROGRESS("매칭 진행중"), | ||
CANCELED("매칭 취소됨"), | ||
FINISHED("매칭 종료됨") | ||
; | ||
|
||
private final String description; | ||
|
||
MatchingStatus(String description) { | ||
this.description = description; | ||
} | ||
|
||
public void validateAvailableCancel() { | ||
if (this != PROGRESS) { | ||
throw new MatchingException(MATCHING_CANCEL_NOT_ALLOWED); | ||
} | ||
} | ||
} |
Oops, something went wrong.