Skip to content

Commit

Permalink
feat: Organization Link 연결 (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
kimday0326 authored Jul 23, 2024
1 parent 8e3a794 commit 16b9409
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;

import com.sponus.coredomain.domain.organization.club.Club;
import com.sponus.sponusbe.domain.organizationLink.dto.response.OrganizationLinkGetResponse;

public record ClubGetResponse(
Long id,
Expand All @@ -16,9 +17,14 @@ public record ClubGetResponse(
String profileStatus,
String role,
int memberCount,
List<OrganizationLinkGetResponse> links,
List<String> clubTypes
) {
public static ClubGetResponse of(Club club) {
final List<OrganizationLinkGetResponse> links = club.getOrganizationLinks()
.stream()
.map(OrganizationLinkGetResponse::from)
.toList();
return new ClubGetResponse(
club.getId(),
club.getName(),
Expand All @@ -31,6 +37,7 @@ public static ClubGetResponse of(Club club) {
club.getProfileStatus().name(),
club.getRole().name(),
club.getMemberCount(),
links,
club.getSubTypeNames()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public class OrganizationLinkQueryService {
public OrganizationLinkGetResponse getOrganizationLink(Long organizationLinkId) {
OrganizationLink organizationLink = organizationLinkRepository.findById(organizationLinkId)
.orElseThrow(() -> new OrganizationException(ORGANIZATION_LINK_NOT_FOUND));

return OrganizationLinkGetResponse.from(organizationLink);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public class Organization extends BaseEntity {
@Column(name = "is_deleted")
private boolean isDeleted;

@Builder.Default
@OneToMany(mappedBy = "organization", cascade = {CascadeType.ALL}, orphanRemoval = true)
private List<OrganizationLink> organizationLinks = new ArrayList<>();

@Builder.Default
@OneToMany(cascade = {CascadeType.ALL})
private List<Bookmark> bookmarks = new ArrayList<>();
Expand Down

0 comments on commit 16b9409

Please sign in to comment.