-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] 선택한 구역에 대한 프로젝트, 프로필 카드 리스트 랜덤 조회 API, 프로젝트 매칭 요청 생성 API 개발 #92
Merged
Merged
Changes from 36 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
9f47544
[FEAT] 선택한 구역의 '대기중'인 프로젝트 카드 리스트 랜덤 조회 메서드 추가, 커서 기반 페이지네이션 공통 포맷 적용
JIN-076 16a455e
[FEAT] 프로젝트 상세 카드를 조회하는 동적 쿼리 조회 메서드에 커서 기반 페이지네이션 공통 포맷 적용
JIN-076 8c15bf4
[FEAT] Region에 대한 프로젝트 카드 리스트 조회 Controller 구현
JIN-076 67a2590
[FEAT] 프로젝트 카드 랜덤 리스트 조회 API에 대해 Swagger 추가
JIN-076 58a5763
[FEAT] 프로필 카드 리스트 랜덤 조회 API 구현
JIN-076 3bf2296
[FEAT] 프로필 카드 리스트 랜덤 조회 비즈니스 로직 구현, 커서 기반 페이지네이션 공통 포맷 적용
JIN-076 a8cffd8
[FEAT] 프로필 카드 리스트 랜덤 조회 API를 Swagger에 추가
JIN-076 b2f4046
[FEAT] 프로젝트 카드 상세 페이지 응답 DTO 구현
JIN-076 c820816
[FEAT] 프로필 카드 동적 쿼리 조회 메서드 구현, 커서 기반 페이지네이션 및 공통 포맷 적용
JIN-076 3ac6e2e
Merge remote-tracking branch 'origin/develop' into feat/#30-cards_lis…
JIN-076 76e51d4
[REFACT] 선택한 구역에 대한 프로필 카드 리스트 조회 API 응답 변경
JIN-076 96ea7cc
[REFACT] 프로필 카드 리스트 조회 API 응답 타입 Swagger에서 변경
JIN-076 515a405
[REFACT] 프로젝트 카드의 상세 정보를 위해 사용자 정보와 프로젝트 만남 정보에 대한 응답 수정
JIN-076 c04ae43
[REFACT] 프로필 카드의 상세 정보를 위해 사용자 정보에 대한 응답 수정
JIN-076 54fc479
[REFACT] queryDsl에서 Projections.constructor 사용을 위해 public 생성자 생성, pro…
JIN-076 a62c2db
[FEAT] 프로젝트 매칭 엔티티에 private 생성자, 정적 팩토리 메서드 추가 구현
JIN-076 b45d4d3
[FEAT] 프로젝트 매칭 생성 요청 DTO 구현
JIN-076 fd8a7a9
[FEAT] 프로젝트 매칭 중복 생성 검증 메서드 추가 구현
JIN-076 6920c2a
[FEAT] 프로젝트 매칭 요청 관련 에러코드 작성
JIN-076 65d3d3b
[FEAT] 프로젝트 매칭 요청 생성 메서드 구현, 프로젝트 매칭 요청 관련 유효성 검사 메서드 구현
JIN-076 9fb72aa
[FEAT] 프로젝트 매칭 요청 생성 API 작성, API 관련 Swagger 작성, 불필요한 에러코드 제거, 에러코드 관련…
JIN-076 109129f
[FEAT] 프로젝트 매칭 생성 API 응답 DTO 생성
JIN-076 1c8c41d
Merge remote-tracking branch 'origin/develop' into feat/#30-cards_lis…
JIN-076 1c60ea6
[FIX] 패키지명 오타 수정
JIN-076 6f76853
[FIX] 에러코드, 오타 관련 수정
JIN-076 26d0eb6
[FIX] 에러코드, 오타 관련 수정
JIN-076 a4a74fa
[REFACT] 에러코드 수정 (403 -> 400)
JIN-076 a14c337
Merge branch 'feat/#30-cards_list_up_by_zone' of https://github.com/O…
JIN-076 7255df6
[FEAT] pageable 수정
JIN-076 b588366
[REFACT] Profile Card 랜덤 조회 리스트 API 리팩토링
JIN-076 0e47fe4
[REFACT] 읽기전용 @Transactional 추가
JIN-076 b7a828e
[REFACT] 메서드명 변경, 중복 매칭 요청 로직 수정, 네이밍 수정
JIN-076 7d533e5
Merge branch 'develop' into feat/#30-cards_list_up_by_zone
JIN-076 31af58d
Merge 'develop' branch into 'feat/#30-cards_list_up_by_zone'
JIN-076 a374cb5
Merge remote-tracking branch 'origin/feat/#30-cards_list_up_by_zone' …
JIN-076 f90189d
[FEAT] 불필요한 import문 제거
JIN-076 7d71bb1
[REFACT] 어노테이션 수정
JIN-076 769c110
[REFACT] ProjectJoinRequest 엔티티의 Controller 엔드포인트 수정
JIN-076 c012a47
[REFACT] 엔터 제거
JIN-076 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
src/main/java/io/oeid/mogakgo/common/swagger/template/ProfileCardSwagger.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,51 @@ | ||
package io.oeid.mogakgo.common.swagger.template; | ||
|
||
import io.oeid.mogakgo.common.base.CursorPaginationInfoReq; | ||
import io.oeid.mogakgo.common.base.CursorPaginationResult; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerGeoErrorExamples; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerUserErrorExamples; | ||
import io.oeid.mogakgo.domain.geo.domain.enums.Region; | ||
import io.oeid.mogakgo.domain.user.presentation.dto.res.UserPublicApiResponse; | ||
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.Parameters; | ||
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 = "Profile Card", description = "프로필 카드 관련 API") | ||
public interface ProfileCardSwagger { | ||
|
||
@Operation(summary = "선택한 서비스 지역에 대한 랜덤 순서의 프로필 리스트 조회", description = "사용자가 서비스 지역의 프로필 리스트를 조회할 때 사용하는 API") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "프로필 리스트 조회 성공"), | ||
@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) | ||
)), | ||
}) | ||
@Parameters({ | ||
@Parameter(name = "cursorId", description = "기준이 되는 커서 ID", example = "1"), | ||
@Parameter(name = "pageSize", description = "요청할 데이터 크기", example = "5", required = true), | ||
@Parameter(name = "sortOrder", description = "정렬 방향", example = "ASC"), | ||
}) | ||
ResponseEntity<CursorPaginationResult<UserPublicApiResponse>> getRandomOrderedProfileCardsByRegion( | ||
@Parameter(hidden = true) Long userId, | ||
@Parameter(description = "조회하려는 서비스 지역", required = true) Region region, | ||
@Parameter(hidden = true) CursorPaginationInfoReq pageable | ||
); | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/io/oeid/mogakgo/common/swagger/template/ProjectJoinRequestSwagger.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,56 @@ | ||
package io.oeid.mogakgo.common.swagger.template; | ||
|
||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerProjectErrorExamples; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerProjectJoinRequestErrorExamples; | ||
import io.oeid.mogakgo.core.properties.swagger.error.SwaggerUserErrorExamples; | ||
import io.oeid.mogakgo.domain.project_join_req.application.dto.req.ProjectJoinCreateReq; | ||
import io.oeid.mogakgo.domain.project_join_req.presentation.dto.res.ProjectJoinRequestAPIRes; | ||
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 = "Project Join Request", description = "프로젝트 매칭 요청 관련 API") | ||
public interface ProjectJoinRequestSwagger { | ||
|
||
@Operation(summary = "프로젝트 매칭 요청 생성", description = "회원이 프로젝트 매칭 요청을 생성할 때 사용하는 API") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "201", description = "프로젝트 매칭 요청 생성 성공", | ||
content = @Content(schema = @Schema(implementation = ProjectJoinRequestAPIRes.class))), | ||
@ApiResponse(responseCode = "400", description = "요청한 데이터가 유효하지 않음", | ||
content = @Content( | ||
mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = { | ||
@ExampleObject(name = "E090101", | ||
value = SwaggerProjectJoinRequestErrorExamples.PROJECT_JOIN_REQUEST_ALREADY_EXIST), | ||
@ExampleObject(name = "E090102", | ||
value = SwaggerProjectJoinRequestErrorExamples.PROJECT_JOIN_REQUEST_INVALID_REGION) | ||
})), | ||
@ApiResponse(responseCode = "403", description = "프로젝트 매칭 요청 권한이 없음", | ||
content = @Content( | ||
mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = @ExampleObject(name = "E050201", | ||
value = SwaggerProjectJoinRequestErrorExamples.PROJECT_JOIN_REQUEST_FORBIDDEN_OPERATION))), | ||
@ApiResponse(responseCode = "404", description = "요청한 데이터가 존재하지 않음", | ||
content = @Content( | ||
mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorResponse.class), | ||
examples = { | ||
@ExampleObject(name = "E020301", value = SwaggerUserErrorExamples.USER_NOT_FOUND), | ||
@ExampleObject(name = "E030301", value = SwaggerProjectErrorExamples.PROJECT_NOT_FOUND) | ||
})), | ||
}) | ||
ResponseEntity<ProjectJoinRequestAPIRes> create( | ||
@Parameter(hidden = true) Long userId, | ||
ProjectJoinCreateReq request | ||
); | ||
|
||
} |
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
11 changes: 11 additions & 0 deletions
11
...io/oeid/mogakgo/core/properties/swagger/error/SwaggerProjectJoinRequestErrorExamples.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,11 @@ | ||
package io.oeid.mogakgo.core.properties.swagger.error; | ||
|
||
public class SwaggerProjectJoinRequestErrorExamples { | ||
|
||
public static final String PROJECT_JOIN_REQUEST_ALREADY_EXIST = "{\"timestamp\":\"2024-02-17T10:07:31.404Z\",\"statusCode\":400,\"code\":\"E050201\",\"message\":\"이미 매칭 요청을 보낸 프로젝트에 매칭 요청을 보낼 수 없습니다.\"}"; | ||
public static final String PROJECT_JOIN_REQUEST_INVALID_REGION = "{\"timestamp\":\"2024-02-17T10:07:31.404Z\",\"statusCode\":400,\"code\":\"E090102\",\"message\":\"프로젝트 매칭 서비스는 동네 인증되지 않은 구역에서 진행할 수 없습니다.\"}"; | ||
public static final String PROJECT_JOIN_REQUEST_FORBIDDEN_OPERATION = "{\"timestamp\":\"2024-02-17T10:07:31.404Z\",\"statusCode\":403,\"code\":\"E090101\",\"message\":\"프로젝트 생성자는 해당 프로젝트에 매칭 요청을 보낼 수 없습니다.\"}"; | ||
private SwaggerProjectJoinRequestErrorExamples() { | ||
} | ||
|
||
} |
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
50 changes: 50 additions & 0 deletions
50
src/main/java/io/oeid/mogakgo/domain/profile/application/ProfileCardService.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.domain.profile.application; | ||
|
||
import static io.oeid.mogakgo.exception.code.ErrorCode400.INVALID_SERVICE_REGION; | ||
|
||
import io.oeid.mogakgo.common.base.CursorPaginationInfoReq; | ||
import io.oeid.mogakgo.common.base.CursorPaginationResult; | ||
import io.oeid.mogakgo.domain.geo.domain.enums.Region; | ||
import io.oeid.mogakgo.domain.geo.exception.GeoException; | ||
import io.oeid.mogakgo.domain.profile.infrastructure.ProfileCardJpaRepository; | ||
import io.oeid.mogakgo.domain.user.application.UserCommonService; | ||
import io.oeid.mogakgo.domain.user.domain.User; | ||
import io.oeid.mogakgo.domain.user.presentation.dto.res.UserPublicApiResponse; | ||
import java.util.Collections; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@Transactional(readOnly = true) | ||
@RequiredArgsConstructor | ||
public class ProfileCardService { | ||
|
||
private final ProfileCardJpaRepository profileCardRepository; | ||
private final UserCommonService userCommonService; | ||
|
||
public CursorPaginationResult<UserPublicApiResponse> getRandomOrderedProfileCardsByRegion( | ||
Long userId, Region region, CursorPaginationInfoReq pageable | ||
) { | ||
validateToken(userId); | ||
validateRegionCoverage(region); | ||
|
||
CursorPaginationResult<UserPublicApiResponse> projects = profileCardRepository | ||
.findByConditionWithPagination( | ||
null, region, pageable | ||
); | ||
Collections.shuffle(projects.getData()); | ||
return projects; | ||
} | ||
|
||
private User validateToken(Long userId) { | ||
return userCommonService.getUserById(userId); | ||
} | ||
|
||
private void validateRegionCoverage(Region region) { | ||
if (Region.getByAreaCode(region.getAreaCode()) == null) { | ||
throw new GeoException(INVALID_SERVICE_REGION); | ||
} | ||
} | ||
|
||
} |
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
10 changes: 5 additions & 5 deletions
10
src/main/java/io/oeid/mogakgo/domain/profile/infrastructure/ProfileCardRepositoryCustom.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,13 +1,13 @@ | ||
package io.oeid.mogakgo.domain.profile.infrastructure; | ||
|
||
import io.oeid.mogakgo.common.base.CursorPaginationInfoReq; | ||
import io.oeid.mogakgo.common.base.CursorPaginationResult; | ||
import io.oeid.mogakgo.domain.geo.domain.enums.Region; | ||
import io.oeid.mogakgo.domain.profile.domain.entity.ProfileCard; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.domain.Slice; | ||
import io.oeid.mogakgo.domain.user.presentation.dto.res.UserPublicApiResponse; | ||
|
||
public interface ProfileCardRepositoryCustom { | ||
|
||
Slice<ProfileCard> findByCondition( | ||
Long cursorId, Long userId, Region region, Pageable pageable | ||
CursorPaginationResult<UserPublicApiResponse> findByConditionWithPagination( | ||
Long userId, Region region, CursorPaginationInfoReq pageable | ||
); | ||
} |
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
35 changes: 35 additions & 0 deletions
35
src/main/java/io/oeid/mogakgo/domain/profile/presentation/ProfileCardController.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,35 @@ | ||
package io.oeid.mogakgo.domain.profile.presentation; | ||
|
||
import io.oeid.mogakgo.common.annotation.UserId; | ||
import io.oeid.mogakgo.common.base.CursorPaginationInfoReq; | ||
import io.oeid.mogakgo.common.base.CursorPaginationResult; | ||
import io.oeid.mogakgo.common.swagger.template.ProfileCardSwagger; | ||
import io.oeid.mogakgo.domain.geo.domain.enums.Region; | ||
import io.oeid.mogakgo.domain.profile.application.ProfileCardService; | ||
import io.oeid.mogakgo.domain.user.presentation.dto.res.UserPublicApiResponse; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.ModelAttribute; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api/v1/profiles") | ||
@RequiredArgsConstructor | ||
public class ProfileCardController implements ProfileCardSwagger { | ||
|
||
private final ProfileCardService profileCardService; | ||
|
||
@GetMapping("/{region}") | ||
public ResponseEntity<CursorPaginationResult<UserPublicApiResponse>> getRandomOrderedProfileCardsByRegion( | ||
@UserId Long userId, @PathVariable Region region, | ||
@Valid @ModelAttribute CursorPaginationInfoReq pageable | ||
) { | ||
return ResponseEntity.ok().body( | ||
profileCardService.getRandomOrderedProfileCardsByRegion(userId, region, pageable) | ||
); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
엔터가 두번 눌린 것 같습니다!