-
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.
feat: APP BE 와의 통신을 위한 모임 목록 조회 API 개발 (#486)
* move(external): 알림 관련 기능 internal -> external 로 변경 * chore(Meeting): getMeetingStatusValue 과 getMeetingStatus 메서드 분리 * style(PageOptionsDto): 코드 배치 수정 * chore(SecurityConfig): internal 기능 화이트리스트에 추가 * add(Dto): Dto 추가 * feat(InternalMeetingController): 모임 목록 조회 컨트롤러 구현 * feat(InternalMeetingService): 모임 목록 조회 서비스 로직 구현 * rename(AdvertisementCustomPageable): 기존에 있던 CustomPageable -> AdvertisementCustomPageable 로 이름 변경 * feat(CustomPageable): CustomPageable 구현 및 적용 * fix(CustomPageable): take -> size 수정 * fix: 3항 연산자 -> if 문으로 수정 * docs(InternalMeetingGetAllMeetingQueryDto): 스웨거 설명 추가 * fix(InternalMeetingController): requestBody -> requestParam 변경 * docs(InternalMeetingApi): 스웨거 추가 * docs(AdvertisementCustomPageable): javadoc 추가 * chore: getBlockedUsers 기존 메서드 수정
- Loading branch information
Showing
28 changed files
with
393 additions
and
96 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
37 changes: 19 additions & 18 deletions
37
main/src/main/java/org/sopt/makers/crew/main/entity/meeting/enums/EnMeetingStatus.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,32 +1,33 @@ | ||
package org.sopt.makers.crew.main.entity.meeting.enums; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.sopt.makers.crew.main.global.exception.BadRequestException; | ||
|
||
/** 모임 상태 */ | ||
public enum EnMeetingStatus { | ||
/** 시작 전 */ | ||
BEFORE_START(0), | ||
/** 시작 전 */ | ||
BEFORE_START(0), | ||
|
||
/** 지원 가능 */ | ||
APPLY_ABLE(1), | ||
/** 지원 가능 */ | ||
APPLY_ABLE(1), | ||
|
||
/** 모집 완료 */ | ||
RECRUITMENT_COMPLETE(2); | ||
/** 모집 완료 */ | ||
RECRUITMENT_COMPLETE(2); | ||
|
||
private final int value; | ||
private final int value; | ||
|
||
EnMeetingStatus(int value) { | ||
this.value = value; | ||
} | ||
EnMeetingStatus(int value) { | ||
this.value = value; | ||
} | ||
|
||
public static EnMeetingStatus ofValue(int dbData) { | ||
return Arrays.stream(EnMeetingStatus.values()).filter(v -> v.getValue() == (dbData)).findFirst() | ||
.orElseThrow(() -> new BadRequestException( | ||
String.format("EnMeetingStatus 클래스에 value = [%s] 값을 가진 enum 객체가 없습니다.", dbData))); | ||
} | ||
public static EnMeetingStatus ofValue(int dbData) { | ||
return Arrays.stream(EnMeetingStatus.values()).filter(v -> v.getValue() == (dbData)).findFirst() | ||
.orElseThrow(() -> new BadRequestException( | ||
String.format("EnMeetingStatus 클래스에 value = [%s] 값을 가진 enum 객체가 없습니다.", dbData))); | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
public int getValue() { | ||
return value; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...l/notification/PushNotificationEnums.java → ...l/notification/PushNotificationEnums.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
6 changes: 3 additions & 3 deletions
6
...ication/PushNotificationServerClient.java → ...ication/PushNotificationServerClient.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
2 changes: 1 addition & 1 deletion
2
...ation/dto/PushNotificationRequestDto.java → ...ation/dto/PushNotificationRequestDto.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
...tion/dto/PushNotificationResponseDto.java → ...tion/dto/PushNotificationResponseDto.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
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
85 changes: 85 additions & 0 deletions
85
main/src/main/java/org/sopt/makers/crew/main/global/util/AdvertisementCustomPageable.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,85 @@ | ||
package org.sopt.makers.crew.main.global.util; | ||
|
||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.domain.Sort; | ||
|
||
/** | ||
* AdvertisementCustomPageable : 광고 관련된 컨텐츠에 대해 페이지네이션이 필요할 때 사용하는 클래스 | ||
* | ||
* @implSpec : 광고 때문에 첫페이지는 11개를, 나머지는 12개를 반환해야 한다. | ||
* @implNote : 일반적인 페이지네이션 방식과 다르기에 해당 클래스를 따로 만들어 커스텀화하였다. | ||
* */ | ||
public class AdvertisementCustomPageable implements Pageable { | ||
|
||
private final int page; | ||
private final int size; | ||
private final Sort sort; | ||
|
||
public AdvertisementCustomPageable(int page, Sort sort) { | ||
this.page = page; | ||
this.sort = sort; | ||
this.size = calculateSize(page); | ||
} | ||
|
||
private int calculateSize(int page) { | ||
// 첫 번째 페이지는 11개, 그 이후부터는 12개 | ||
if (page == 0) { | ||
return 11; | ||
} | ||
return 12; | ||
} | ||
|
||
@Override | ||
public int getPageNumber() { | ||
return this.page; | ||
} | ||
|
||
@Override | ||
public int getPageSize() { | ||
return this.size; | ||
} | ||
|
||
@Override | ||
public long getOffset() { | ||
// 오프셋 계산 | ||
// 첫 번째 페이지는 11개, 그 이후부터는 12개 고려 | ||
if (page == 0) { | ||
return 0; | ||
} | ||
return 11 + (page - 1) * 12L; | ||
} | ||
|
||
@Override | ||
public Sort getSort() { | ||
return this.sort; | ||
} | ||
|
||
@Override | ||
public Pageable next() { | ||
return new AdvertisementCustomPageable(this.page + 1, this.sort); | ||
} | ||
|
||
@Override | ||
public Pageable previousOrFirst() { | ||
if (page == 0) { | ||
return this; | ||
} | ||
return new AdvertisementCustomPageable(this.page - 1, this.sort); | ||
} | ||
|
||
@Override | ||
public Pageable first() { | ||
return new AdvertisementCustomPageable(0, this.sort); | ||
} | ||
|
||
@Override | ||
public boolean hasPrevious() { | ||
return this.page > 0; | ||
} | ||
|
||
@Override | ||
public Pageable withPage(int pageNumber) { | ||
// 새로운 페이지 번호로 CustomPageable 생성 | ||
return new AdvertisementCustomPageable(pageNumber, this.sort); | ||
} | ||
} |
Oops, something went wrong.