-
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 #89 from Open-Eye-Im-Developer/develop
main에 v1.5 반영
- Loading branch information
Showing
84 changed files
with
2,012 additions
and
66 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
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 |
---|---|---|
|
@@ -37,4 +37,5 @@ out/ | |
.vscode/ | ||
|
||
### application.yml ### | ||
application*.yml | ||
application*.yml | ||
firebase*.json |
27 changes: 27 additions & 0 deletions
27
src/main/java/io/oeid/mogakgo/common/base/CursorPaginationInfoReq.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,27 @@ | ||
package io.oeid.mogakgo.common.base; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import java.util.Objects; | ||
import lombok.Getter; | ||
import org.springframework.data.domain.Sort; | ||
import org.springframework.data.domain.Sort.Direction; | ||
import org.springframework.lang.Nullable; | ||
|
||
@Getter | ||
public class CursorPaginationInfoReq { | ||
|
||
@Nullable | ||
private final Long cursorId; | ||
|
||
@NotNull | ||
private final int pageSize; | ||
|
||
@Nullable | ||
private final Sort.Direction sortOrder; | ||
|
||
public CursorPaginationInfoReq(Long cursorId, int pageSize, Direction sortOrder) { | ||
this.cursorId = cursorId; | ||
this.pageSize = pageSize; | ||
this.sortOrder = Objects.requireNonNullElse(sortOrder, Direction.ASC); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/io/oeid/mogakgo/common/base/CursorPaginationResult.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,50 @@ | ||
package io.oeid.mogakgo.common.base; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import lombok.Getter; | ||
|
||
@Schema(description = "커서 기반 페이지네이션 결과에 대한 일괄 응답") | ||
@Getter | ||
public class CursorPaginationResult<T> { | ||
|
||
@Schema(description = "데이터 목록") | ||
private List<T> data; | ||
@Schema(description = "다음 페이지가 있는지 여부") | ||
private boolean hasNext; | ||
@Schema(description = "현재 페이지의 데이터 수") | ||
private Integer numberOfElements; | ||
@Schema(description = "요청한 데이터 수") | ||
private Integer size; | ||
|
||
private CursorPaginationResult(List<T> data, Integer size) { | ||
this.data = data; | ||
this.size = size; | ||
if (data.size() > size) { | ||
this.hasNext = true; | ||
this.data.remove(data.size() - 1); | ||
} else { | ||
this.hasNext = false; | ||
} | ||
this.numberOfElements = data.size(); | ||
} | ||
|
||
private CursorPaginationResult(List<T> data, Integer size, boolean hasNext) { | ||
this.data = data; | ||
this.numberOfElements = data.size(); | ||
this.hasNext = hasNext; | ||
this.size = size; | ||
} | ||
|
||
public static <T> CursorPaginationResult<T> fromDataWithExtraItemForNextCheck( | ||
List<T> data, Integer size | ||
) { | ||
return new CursorPaginationResult<>(data, size); | ||
} | ||
|
||
public static <T> CursorPaginationResult<T> fromDataWithHasNext( | ||
List<T> data, Integer size, boolean hasNext | ||
) { | ||
return new CursorPaginationResult<>(data, size, hasNext); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/io/oeid/mogakgo/common/swagger/template/AuthSwagger.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,36 @@ | ||
package io.oeid.mogakgo.common.swagger.template; | ||
|
||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; | ||
|
||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerAuthErrorExamples; | ||
import io.oeid.mogakgo.domain.auth.presentation.dto.res.AuthAccessTokenResponse; | ||
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 org.springframework.http.ResponseEntity; | ||
|
||
@Tag(name = "Auth", description = "인증 관련 API") | ||
@SuppressWarnings("unused") | ||
public interface AuthSwagger { | ||
|
||
@Operation(summary = "토큰 재발급", description = "Access Token을 재발급 받을 때 사용하는 API") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "토큰 재발급 성공", | ||
content = @Content(schema = @Schema(implementation = AuthAccessTokenResponse.class))), | ||
@ApiResponse(responseCode = "401", description = "재발급 토큰 인증정보가 유효하지 않음", | ||
content = @Content( | ||
mediaType = APPLICATION_JSON_VALUE, | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = @ExampleObject(name = "E010201", value = SwaggerAuthErrorExamples.AUTH_MISSING_CREDENTIALS))) | ||
}) | ||
ResponseEntity<AuthAccessTokenResponse> reissue( | ||
@Parameter(in = ParameterIn.HEADER, hidden = true) String accessToken, | ||
@Parameter(in = ParameterIn.COOKIE) String refreshToken); | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/io/oeid/mogakgo/common/swagger/template/CertSwagger.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,48 @@ | ||
package io.oeid.mogakgo.common.swagger.template; | ||
|
||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerCertErrorExamples; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerGeoErrorExamples; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerUserErrorExamples; | ||
import io.oeid.mogakgo.domain.cert.presentation.dto.req.UserRegionCertAPIReq; | ||
import io.oeid.mogakgo.domain.cert.presentation.dto.res.UserRegionCertAPIRes; | ||
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.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 org.springframework.http.ResponseEntity; | ||
|
||
@Tag(name = "Cert", description = "동네 인증 관련 API") | ||
@SuppressWarnings("unused") | ||
public interface CertSwagger { | ||
|
||
@Operation(summary = "동네 인증 완료 응답", description = "동네 인증 완료를 요청할 때 사용하는 API" | ||
) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "동네 인증 요청 성공", | ||
content = @Content(schema = @Schema(implementation = UserRegionCertAPIRes.class))), | ||
@ApiResponse(responseCode = "400", description = "요청한 데이터가 유효하지 않음", | ||
content = @Content( | ||
mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = @ExampleObject(name = "E080101", value = SwaggerGeoErrorExamples.INVALID_SERVICE_REGION))), | ||
@ApiResponse(responseCode = "403", description = "동네 인증 권한이 없음", | ||
content = @Content( | ||
mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = @ExampleObject(name = "E070201", value = SwaggerCertErrorExamples.INVALID_CERT_INFO))), | ||
@ApiResponse(responseCode = "404", description = "요청한 유저가 존재하지 않음", | ||
content = @Content( | ||
mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = @ExampleObject(name = "E020301", value = SwaggerUserErrorExamples.USER_NOT_FOUND))), | ||
}) | ||
ResponseEntity<UserRegionCertAPIRes> certificateNeighborhood( | ||
@Parameter(hidden = true) Long userId, | ||
UserRegionCertAPIReq request | ||
); | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/io/oeid/mogakgo/common/swagger/template/GeoSwagger.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,43 @@ | ||
package io.oeid.mogakgo.common.swagger.template; | ||
|
||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerGeoErrorExamples; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerUserErrorExamples; | ||
import io.oeid.mogakgo.domain.geo.presentation.dto.res.UserRegionInfoAPIRes; | ||
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.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 org.springframework.http.ResponseEntity; | ||
|
||
@Tag(name = "Geo", description = "지역 관련 API") | ||
@SuppressWarnings("unused") | ||
public interface GeoSwagger { | ||
|
||
@Operation(summary = "GPS에 대한 법정구역코드 응답", description = "사용자의 GPS 좌표의 법정구역코드를 요청할 때 사용하는 API" | ||
) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "법정구역코드 요청 성공", | ||
content = @Content(schema = @Schema(implementation = UserRegionInfoAPIRes.class))), | ||
@ApiResponse(responseCode = "400", description = "요청한 데이터가 유효하지 않음", | ||
content = @Content( | ||
mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = @ExampleObject(name = "E080101", value = SwaggerGeoErrorExamples.INVALID_SERVICE_REGION))), | ||
@ApiResponse(responseCode = "404", description = "요청한 유저가 존재하지 않음", | ||
content = @Content( | ||
mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = @ExampleObject(name = "E020301", value = SwaggerUserErrorExamples.USER_NOT_FOUND))), | ||
}) | ||
ResponseEntity<UserRegionInfoAPIRes> getUserRegionInfoByGPS( | ||
@Parameter(hidden = true) Long userId, | ||
@Parameter(description = "사용자의 GPS 경도", required = true) Double longitude, | ||
@Parameter(description = "사용자의 GPS 위도", required = true) Double latitude | ||
); | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/io/oeid/mogakgo/common/swagger/template/NotificationSwagger.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 io.oeid.mogakgo.common.swagger.template; | ||
|
||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; | ||
|
||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerUserErrorExamples; | ||
import io.oeid.mogakgo.domain.notification.presentation.dto.req.FCMTokenApiRequest; | ||
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.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.tags.Tag; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
@Tag(name = "Notification", description = "알림 관련 API") | ||
@SuppressWarnings("unused") | ||
public interface NotificationSwagger { | ||
|
||
@Operation(summary = "FCM 토큰 저장", description = "회원의 FCM 토큰을 저장할 때 사용하는 API") | ||
@ApiResponse(responseCode = "200", description = "FCM 토큰 저장 성공") | ||
@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<Void> manageFCMToken(@Parameter(hidden = true) Long userId, | ||
FCMTokenApiRequest request); | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/io/oeid/mogakgo/common/swagger/template/OAuth2Swagger.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,29 @@ | ||
package io.oeid.mogakgo.common.swagger.template; | ||
|
||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; | ||
|
||
import io.oeid.mogakgo.domain.auth.presentation.dto.res.AuthAccessTokenResponse; | ||
import io.oeid.mogakgo.domain.auth.presentation.dto.res.AuthLoginUrlResponse; | ||
import io.swagger.v3.oas.annotations.Hidden; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
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 jakarta.servlet.http.HttpServletResponse; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.oauth2.core.user.OAuth2User; | ||
|
||
@Tag(name = "OAuth2", description = "OAuth2 관련 API") | ||
@SuppressWarnings("unused") | ||
public interface OAuth2Swagger { | ||
@Operation(summary = "로그인 URL 반환", description = "로그인 URL을 반환하는 API") | ||
@ApiResponse(responseCode = "200", description = "로그인 URL 반환 성공", | ||
content = @Content( | ||
mediaType = APPLICATION_JSON_VALUE, | ||
schema = @Schema(implementation = AuthLoginUrlResponse.class))) | ||
ResponseEntity<AuthLoginUrlResponse> login(); | ||
@Hidden | ||
ResponseEntity<AuthAccessTokenResponse> loginSuccess( | ||
OAuth2User oAuth2User, HttpServletResponse response); | ||
} |
Oops, something went wrong.