-
Notifications
You must be signed in to change notification settings - Fork 5
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
[BE] issue245: 스터디 가입날짜 및 스터디 개수 #246
Changes from 11 commits
4091bf3
d201465
d012422
9ed259b
d8785a2
3558891
dc5a497
7a2c5a1
7bdf2df
9ce7a2d
64055d9
7298dc0
e111b04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.woowacourse.moamoa.member.query.data; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.time.LocalDate; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@AllArgsConstructor | ||
@EqualsAndHashCode | ||
@ToString | ||
public class MemberFullData { | ||
|
||
@JsonProperty("id") | ||
private Long githubId; | ||
|
||
private String username; | ||
|
||
private String imageUrl; | ||
|
||
private String profileUrl; | ||
|
||
private LocalDate participationDate; | ||
|
||
private int numberOfStudy; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
import static lombok.AccessLevel.PROTECTED; | ||
|
||
import java.time.LocalDate; | ||
import javax.persistence.Column; | ||
import javax.persistence.Embeddable; | ||
import lombok.AllArgsConstructor; | ||
|
@@ -20,4 +21,12 @@ public class Participant { | |
|
||
@Column(name = "member_id", nullable = false) | ||
private Long memberId; | ||
|
||
@Column(updatable = false, nullable = false) | ||
private LocalDate participationDate; | ||
Comment on lines
+25
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 참여일자 추가 굿 |
||
|
||
public Participant(final Long memberId) { | ||
this.memberId = memberId; | ||
this.participationDate = LocalDate.now(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,8 @@ | |
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = PROTECTED) | ||
@Getter | ||
@NoArgsConstructor(access = PROTECTED) | ||
Comment on lines
-19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 순서를 바꾸셨는데 이건 정말 궁금해서 여쭤보는거에요! 혹시 바꾼 이유가 있나요? 중요한 순서라기엔 오름차순이나 내림차순 둘다 Getter가 처음이나 마지막이어야 할 것 같은데 궁금합니다! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 어.. 이건 아마 구현하는 중에 변경된 것 같습니다..!! |
||
public class Study { | ||
|
||
@Id | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.woowacourse.moamoa.study.service.response; | ||
|
||
import com.woowacourse.moamoa.member.query.data.MemberData; | ||
import com.woowacourse.moamoa.member.query.data.MemberFullData; | ||
import com.woowacourse.moamoa.study.query.data.StudyDetailsData; | ||
import com.woowacourse.moamoa.tag.query.response.TagData; | ||
import java.time.LocalDate; | ||
|
@@ -29,11 +30,11 @@ public class StudyDetailResponse { | |
private LocalDate startDate; | ||
private LocalDate endDate; | ||
private MemberData owner; | ||
private List<MemberData> members; | ||
private List<MemberFullData> members; | ||
private List<TagData> tags; | ||
|
||
public StudyDetailResponse(final StudyDetailsData study, | ||
final List<MemberData> participants, | ||
final List<MemberFullData> participants, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 클래스명을 MemberData에서 MemberFullData로 변경한 이유가 궁금해요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
final List<TagData> attachedTags) { | ||
this.id = study.getId(); | ||
this.title = study.getTitle(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,7 +235,7 @@ void searchBySameAndDifferentKindFilters() { | |
|
||
@DisplayName("스터디 상세 정보를 조회할 수 있다.") | ||
@Test | ||
public void mentgetStudyDetails() { | ||
public void getStudyDetails() { | ||
StudyDetailsData expect = StudyDetailsData.builder() | ||
// Study Content | ||
.id(javaStudyId).title("Java 스터디").excerpt("자바 설명").thumbnail("java thumbnail") | ||
|
@@ -309,7 +309,6 @@ public void getStudyDetailsWithOptional() { | |
@DisplayName("스터디 참여자와 부착된 태그가 없는 스터디의 세부사항 조회") | ||
@Test | ||
void getNotHasParticipantsAndAttachedTagsStudyDetails() { | ||
|
||
final StudyDetailsData expect = StudyDetailsData.builder() | ||
// Study Content | ||
.id(linuxStudyId).title("Linux 스터디").excerpt("리눅스 설명").thumbnail("linux thumbnail") | ||
|
@@ -337,6 +336,24 @@ void getNotHasParticipantsAndAttachedTagsStudyDetails() { | |
assertAttachedTags(actual.getTags(), expectAttachedTags); | ||
} | ||
|
||
@DisplayName("스터디 디테일 정보 조회 시 스터디원들이 가입한 스터디의 수와 가입날짜도 함께 조회한다.") | ||
@Test | ||
public void findStudyDetailsWithNumberOfStudy() { | ||
final ResponseEntity<StudyDetailResponse> response = sut.getStudyDetails(javaStudyId); | ||
|
||
final StudyDetailResponse responseBody = response.getBody(); | ||
|
||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); | ||
assertThat(responseBody.getMembers()) | ||
.filteredOn(member -> member.getParticipationDate() != null) | ||
.hasSize(2) | ||
.extracting("githubId", "username", "imageUrl", "profileUrl", "numberOfStudy") | ||
.containsExactlyInAnyOrder( | ||
tuple(dwoo.getGithubId(), dwoo.getUsername(), dwoo.getImageUrl(), dwoo.getProfileUrl(), 3), | ||
tuple(verus.getGithubId(), verus.getUsername(), verus.getImageUrl(), verus.getProfileUrl(), 4) | ||
); | ||
Comment on lines
+351
to
+354
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 부분은 순서가 중요한 부분은 아니라서 containsExactly가 아닌 InAnyOrder를 하신거군요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵..!! 순서까지 고려하려면 너무 initDataBase 에서 순서까지 고려해줘야하고 다른 테스트들에도 영향이 있어서요..!! |
||
} | ||
|
||
private void assertStudyContent(final StudyDetailResponse actual, final StudyDetailsData expect) { | ||
assertThat(actual.getId()).isEqualTo(expect.getId()); | ||
assertThat(actual.getTitle()).isEqualTo(expect.getTitle()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,7 @@ CREATE TABLE study_member | |
id BIGINT PRIMARY KEY AUTO_INCREMENT, | ||
study_id BIGINT, | ||
member_id BIGINT, | ||
participation_date DATE not null, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 굿굿 |
||
FOREIGN KEY (study_id) REFERENCES study (id), | ||
FOREIGN KEY (member_id) REFERENCES member (id) | ||
); | ||
|
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.
MemberFullData보다는 다른 이름이 좋아 보입니다. 예를 들어 ParticipantData라든가