Skip to content

Commit

Permalink
chore: formTag 추가 (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekks authored Aug 20, 2024
1 parent c69f638 commit 8bc5e28
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public record SpaceWithMemberCountInfo(

@Schema(description = "설정된 회고 폼 아이디")
Long formId,
@Schema(description = "설정된 회고 폼 태그")
String formTag,

@Schema(description = "소속된 회원 수")
Long memberCount,
Expand Down Expand Up @@ -75,6 +77,7 @@ public static SpaceWithMemberCountInfo toResponse(SpaceWithMemberCount space) {
.name(it.getName())
.introduction(it.getIntroduction())
.formId(it.getFormId())
.formTag(it.getFormTag())
.memberCount(it.getMemberCount())
.bannerUrl(it.getBannerUrl())
.createdAt(it.getCreatedAt())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;

import org.layer.domain.form.enums.FormTag;
import org.layer.domain.member.entity.Member;
import org.layer.domain.space.entity.SpaceCategory;
import org.layer.domain.space.entity.SpaceField;
Expand All @@ -29,12 +31,14 @@ public class SpaceWithMemberCount {
@NotNull
private Leader leader;
private Long formId;
private String formTag;
private Long memberCount;

private String bannerUrl;

@QueryProjection
public SpaceWithMemberCount(Long id, LocalDateTime createdAt, LocalDateTime updatedAt, SpaceCategory category, List<SpaceField> fieldList, String name, String introduction, Member leader, Long formId, Long memberCount, String bannerUrl) {
public SpaceWithMemberCount(Long id, LocalDateTime createdAt, LocalDateTime updatedAt, SpaceCategory category, List<SpaceField> fieldList, String name, String introduction, Member leader, Long formId, FormTag formTag, Long memberCount, String bannerUrl) {

this.id = id;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
Expand All @@ -44,6 +48,7 @@ public SpaceWithMemberCount(Long id, LocalDateTime createdAt, LocalDateTime upda
this.introduction = introduction;
this.leader = Leader.builder().id(leader.getId()).name(leader.getName()).build();
this.formId = formId;
this.formTag = formTag != null ? formTag.getTag() : null;
this.memberCount = memberCount;
this.bannerUrl = bannerUrl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,17 @@ private JPAQuery<SpaceWithMemberCount> getSpaceWithMemberCountQuery() {
space.introduction,
member,
space.formId,
form.formTag,
memberCountRelationTable.space.id.count().as("memberCount"),
space.bannerUrl
))
.from(space)
.leftJoin(memberSpaceRelation).on(space.id.eq(memberSpaceRelation.space.id))
.leftJoin(memberCountRelationTable).on(space.id.eq(memberCountRelationTable.space.id))
.leftJoin(member).on(space.leaderId.eq(member.id))
.leftJoin(form).on(space.formId.eq(form.spaceId));
.leftJoin(form).on(space.formId.eq(form.id))
.orderBy(form.id.desc())
.limit(1);

}

Expand Down

0 comments on commit 8bc5e28

Please sign in to comment.