-
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.
v2.2.3
- Loading branch information
Showing
33 changed files
with
521 additions
and
99 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
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.