-
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.
- Loading branch information
Showing
4 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/main/java/io/oeid/mogakgo/common/swagger/template/ChatSwagger.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,55 @@ | ||
package io.oeid.mogakgo.common.swagger.template; | ||
|
||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; | ||
|
||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerChatErrorExamples; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerProjectErrorExamples; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerUserErrorExamples; | ||
import io.oeid.mogakgo.domain.chat.application.dto.res.ChatRoomDataRes; | ||
import io.oeid.mogakgo.domain.chat.application.dto.res.ChatRoomPublicRes; | ||
import io.oeid.mogakgo.exception.dto.ErrorResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.enums.ParameterIn; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.ExampleObject; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
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 java.util.List; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
@Tag(name = "Chat", description = "채팅 관련 API") | ||
@SuppressWarnings("unused") | ||
public interface ChatSwagger { | ||
|
||
@Operation(summary = "채팅방 목록 조회", description = "사용자의 채팅방 목록을 조회하는 API") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "채팅방 목록 조회 성공"), | ||
@ApiResponse(responseCode = "404", description = "요청한 유저가 존재하지 않음", | ||
content = @Content( | ||
mediaType = APPLICATION_JSON_VALUE, | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = @ExampleObject(name = "E020301", value = SwaggerUserErrorExamples.USER_NOT_FOUND) | ||
)) | ||
}) | ||
ResponseEntity<List<ChatRoomPublicRes>> getChatRoomList(@Parameter(hidden = true) Long userId); | ||
|
||
@Operation(summary = "채팅방 상세 조회", description = "채팅방의 상세 정보를 조회하는 API") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "채팅방 상세 조회 성공"), | ||
@ApiResponse(responseCode = "404", description = "요청한 데이터가 유효하지 않음", | ||
content = @Content( | ||
mediaType = APPLICATION_JSON_VALUE, | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = { | ||
@ExampleObject(name = "E020301", value = SwaggerUserErrorExamples.USER_NOT_FOUND), | ||
@ExampleObject(name = "E030301", value = SwaggerProjectErrorExamples.PROJECT_NOT_FOUND), | ||
@ExampleObject(name = "E110301", value = SwaggerChatErrorExamples.CHAT_ROOM_NOT_FOUND) | ||
} | ||
)) | ||
}) | ||
ResponseEntity<ChatRoomDataRes> getChatRoomDetailData(@Parameter(hidden = true) Long userId, | ||
@Parameter(in = ParameterIn.PATH) String chatRoomId); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/io/oeid/mogakgo/core/properties/swagger/error/SwaggerChatErrorExamples.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 SwaggerChatErrorExamples { | ||
|
||
public static final String CHAT_ROOM_NOT_FOUND = "{\"timestamp\":\"2024-02-17T10:07:31.404Z\",\"statusCode\":404,\"code\":\"E110301\",\"message\":\"해당 채팅방이 존재하지 않습니다.\"}"; | ||
|
||
private SwaggerChatErrorExamples() { | ||
} | ||
} |
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