Skip to content

Commit

Permalink
Merge pull request #81 from study-hub-inu/feat/SH-302-post
Browse files Browse the repository at this point in the history
Feat/sh 302 post
  • Loading branch information
elyudwo authored Jan 28, 2024
2 parents ba0f90f + af1d39e commit 9d144a0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class StudyPostEntity extends BaseTimeEntity {
private Long studyId;

@Builder
public StudyPostEntity(Long id, String title, String content, String chatUrl, MajorType major, int studyPerson, GenderType filteredGender, StudyWayType studyWay, int penalty, String penaltyWay, LocalDate studyStartDate, LocalDate studyEndDate, Long postedUserId, int remainingSeat, Long studyId) {
public StudyPostEntity(Long id, String title, String content, String chatUrl, MajorType major, int studyPerson, GenderType filteredGender, StudyWayType studyWay, int penalty, String penaltyWay, boolean close, LocalDate studyStartDate, LocalDate studyEndDate, Long postedUserId, int remainingSeat, Long studyId) {
this.id = id;
this.title = title;
this.content = content;
Expand All @@ -81,6 +81,7 @@ public StudyPostEntity(Long id, String title, String content, String chatUrl, Ma
this.studyWay = studyWay;
this.penalty = penalty;
this.penaltyWay = penaltyWay;
this.close = close;
this.studyStartDate = studyStartDate;
this.studyEndDate = studyEndDate;
this.postedUserId = postedUserId;
Expand All @@ -98,6 +99,7 @@ public void update(UpdateStudyPostInfo info) {
this.studyWay = info.getStudyWay();
this.penalty = info.getPenalty();
this.penaltyWay = info.getPenaltyWay();
this.close = info.isClose();
this.studyStartDate = info.getStudyStartDate();
this.studyEndDate = info.getStudyEndDate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@

@Getter
public class UpdateStudyPostInfo {
private Long postId;
private Long userId;
private String title;
private String content;
private String chatUrl;
private MajorType major;
private int studyPerson;
private int penalty;
private String penaltyWay;
private GenderType gender;
private StudyWayType studyWay;
private LocalDate studyStartDate;
private LocalDate studyEndDate;
private final Long postId;
private final Long userId;
private final String title;
private final String content;
private final String chatUrl;
private final MajorType major;
private final int studyPerson;
private final int penalty;
private final String penaltyWay;
private final boolean close;
private final GenderType gender;
private final StudyWayType studyWay;
private final LocalDate studyStartDate;
private final LocalDate studyEndDate;

@Builder
public UpdateStudyPostInfo(Long postId, Long userId, String title, String content, String chatUrl, MajorType major, int studyPerson, int penalty, String penaltyWay, GenderType gender, StudyWayType studyWay, LocalDate studyStartDate, LocalDate studyEndDate) {
public UpdateStudyPostInfo(Long postId, Long userId, String title, String content, String chatUrl, MajorType major, int studyPerson, int penalty, String penaltyWay, boolean close, GenderType gender, StudyWayType studyWay, LocalDate studyStartDate, LocalDate studyEndDate) {
this.postId = postId;
this.userId = userId;
this.title = title;
Expand All @@ -35,6 +36,7 @@ public UpdateStudyPostInfo(Long postId, Long userId, String title, String conten
this.studyPerson = studyPerson;
this.penalty = penalty;
this.penaltyWay = penaltyWay;
this.close = close;
this.gender = gender;
this.studyWay = studyWay;
this.studyStartDate = studyStartDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,6 @@ public class CreatePostRequest {
@NotNull(message = "스터디 종료 날짜 작성은 필수입니다!")
private LocalDate studyEndDate;

@Builder
public CreatePostRequest(String title, String content, String chatUrl, MajorType major, int studyPerson, int penalty, String penaltyWay, boolean close, GenderType gender, StudyWayType studyWay, LocalDate studyStartDate, LocalDate studyEndDate) {
this.title = title;
this.content = content;
this.chatUrl = chatUrl;
this.major = major;
this.studyPerson = studyPerson;
this.penalty = penalty;
this.penaltyWay = penaltyWay;
this.close = close;
this.gender = gender;
this.studyWay = studyWay;
this.studyStartDate = studyStartDate;
this.studyEndDate = studyEndDate;
}

public StudyEntity toStudyEntity(Long userId) {
return StudyEntity.builder()
.title(title)
Expand All @@ -112,11 +96,28 @@ public StudyPostEntity toStudyPostEntity(Long userId, Long studyId) {
.studyWay(studyWay)
.penalty(penalty)
.penaltyWay(penaltyWay)
.close(close)
.studyStartDate(studyStartDate)
.studyEndDate(studyEndDate)
.postedUserId(userId)
.remainingSeat(studyPerson)
.studyId(studyId)
.build();
}

@Builder
public CreatePostRequest(String title, String content, String chatUrl, MajorType major, int studyPerson, int penalty, String penaltyWay, boolean close, GenderType gender, StudyWayType studyWay, LocalDate studyStartDate, LocalDate studyEndDate) {
this.title = title;
this.content = content;
this.chatUrl = chatUrl;
this.major = major;
this.studyPerson = studyPerson;
this.penalty = penalty;
this.penaltyWay = penaltyWay;
this.close = close;
this.gender = gender;
this.studyWay = studyWay;
this.studyStartDate = studyStartDate;
this.studyEndDate = studyEndDate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public List<PostDataByUserId> findByPostedUserId(final Long userId, final Pageab
)
.from(post)
.where(post.postedUserId.eq(userId))
.orderBy(post.createdDate.desc())
.orderBy(post.close.asc(), post.createdDate.desc())
.offset(pageable.getOffset())
.limit(pageable.getPageSize() + 1);

Expand Down

0 comments on commit 9d144a0

Please sign in to comment.