Skip to content
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

GETP-301 feat: 피플 목록 조회 모자이크 기능 추가 #174

Merged
merged 8 commits into from
Oct 13, 2024
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package es.princip.getp.api.controller.people.query;

import es.princip.getp.api.controller.people.query.dto.peopleProfile.DetailPeopleProfileResponse;
import es.princip.getp.api.controller.people.query.dto.peopleProfile.PeopleProfileDetailResponse;
import es.princip.getp.api.security.details.PrincipalDetails;
import es.princip.getp.api.support.dto.ApiResponse;
import es.princip.getp.api.support.dto.ApiResponse.ApiSuccessResult;
Expand Down Expand Up @@ -29,10 +29,10 @@ public class MyPeopleProfileQueryController {
*/
@GetMapping
@PreAuthorize("hasRole('PEOPLE') and isAuthenticated()")
public ResponseEntity<ApiSuccessResult<DetailPeopleProfileResponse>> getMyPeopleProfile(
public ResponseEntity<ApiSuccessResult<PeopleProfileDetailResponse>> getMyPeopleProfile(
@AuthenticationPrincipal final PrincipalDetails principalDetails) {
final MemberId memberId = principalDetails.getMember().getId();
final DetailPeopleProfileResponse response = getMyPeopleQuery.getDetailProfileBy(memberId);
final PeopleProfileDetailResponse response = getMyPeopleQuery.getDetailProfileBy(memberId);
return ApiResponse.success(HttpStatus.OK, response);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package es.princip.getp.api.controller.people.query;

import es.princip.getp.api.controller.people.query.dto.people.CardPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.people.DetailPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.people.PublicDetailPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.people.PeopleDetailResponse;
import es.princip.getp.api.security.details.PrincipalDetails;
import es.princip.getp.api.support.ControllerSupport;
import es.princip.getp.api.support.dto.ApiResponse;
Expand All @@ -12,7 +11,6 @@
import es.princip.getp.application.people.command.PeopleSearchFilter;
import es.princip.getp.application.people.port.in.GetPeopleQuery;
import es.princip.getp.domain.member.model.Member;
import es.princip.getp.domain.member.model.MemberId;
import es.princip.getp.domain.people.model.PeopleId;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
Expand Down Expand Up @@ -43,13 +41,11 @@ public ResponseEntity<? extends ApiSuccessResult<?>> getPeople(
@AuthenticationPrincipal final PrincipalDetails principalDetails,
@PathVariable final Long peopleId
) {
final PeopleId id = new PeopleId(peopleId);
if (isAuthenticated(principalDetails)) {
final MemberId memberId = Optional.ofNullable(principalDetails).map(pd -> pd.getMember().getId()).orElse(null);
final DetailPeopleResponse response = getPeopleQuery.getDetailBy(memberId, id);
return ApiResponse.success(HttpStatus.OK, response);
}
final PublicDetailPeopleResponse response = getPeopleQuery.getPublicDetailBy(id);
final PeopleId pid = new PeopleId(peopleId);
final Member member = Optional.ofNullable(principalDetails)
.map(PrincipalDetails::getMember)
.orElse(null);
final PeopleDetailResponse response = getPeopleQuery.getDetailBy(member, pid);
return ApiResponse.success(HttpStatus.OK, response);
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package es.princip.getp.api.controller.people.query.dto.people;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.util.List;
import es.princip.getp.api.controller.people.query.dto.peopleProfile.PeopleProfileDetailResponse;
import es.princip.getp.api.controller.people.query.dto.peopleProfile.PortfolioResponse;
import es.princip.getp.domain.people.model.Education;
import lombok.Getter;

@Getter
public class PeopleDetailResponse {
private final Long peopleId;
private final String nickname;
private final String profileImageUri;
private final long completedProjectsCount;
private final long likesCount;
@JsonInclude(NON_NULL) private final Boolean liked;
private PeopleProfileDetailResponse profile;

public PeopleDetailResponse(
final Long peopleId,
final String nickname,
final String profileImageUri,
final long completedProjectsCount,
final long likesCount,
final Boolean liked,
final PeopleProfileDetailResponse profile
) {
this.peopleId = peopleId;
this.nickname = nickname;
this.profileImageUri = profileImageUri;
this.completedProjectsCount = completedProjectsCount;
this.likesCount = likesCount;
this.liked = liked;
this.profile = profile;
}

public PeopleDetailResponse mosaic(
final String introduction,
final String activityArea,
final Education education,
final List<String> techStacks,
final List<PortfolioResponse> portfolios
) {
if (profile != null) {
profile.mosaic(introduction, activityArea, education, techStacks, portfolios);
}
return this;
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package es.princip.getp.api.controller.people.query.dto.peopleProfile;

import java.util.List;

import es.princip.getp.domain.people.model.Education;
import lombok.Getter;

@Getter
public class PeopleProfileDetailResponse {
private String introduction;
private String activityArea;
private Education education;
private List<String> techStacks;
private final List<String> hashtags;
private List<PortfolioResponse> portfolios;

public PeopleProfileDetailResponse(
final String introduction,
final String activityArea,
final Education education,
final List<String> techStacks,
final List<String> hashtags,
final List<PortfolioResponse> portfolios
) {
this.introduction = introduction;
this.activityArea = activityArea;
this.education = education;
this.techStacks = techStacks;
this.hashtags = hashtags;
this.portfolios = portfolios;
}

public PeopleProfileDetailResponse mosaic(
final String introduction,
final String activityArea,
final Education education,
final List<String> techStacks,
final List<PortfolioResponse> portfolios
) {
this.introduction = introduction;
this.activityArea = activityArea;
this.education = education;
this.techStacks = techStacks;
this.portfolios = portfolios;
return this;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package es.princip.getp.api.controller.project.query.dto;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;

import com.fasterxml.jackson.annotation.JsonInclude;

import es.princip.getp.api.controller.common.dto.AddressResponse;

@JsonInclude(JsonInclude.Include.NON_NULL)
public record ProjectClientResponse(
Long clientId,
@JsonInclude(NON_NULL) Long clientId,
String nickname,
AddressResponse address
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ public ProjectDetailResponse(
this.client = client;
}

public void mosaic(
public ProjectDetailResponse mosaic(
final String description,
final List<String> attachmentFiles,
final ProjectClientResponse client
) {
this.description = description;
this.attachmentFiles = attachmentFiles;
this.client = client;
return this;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package es.princip.getp.application.like.people.port.out;

import es.princip.getp.domain.member.model.Member;
import es.princip.getp.domain.member.model.MemberId;
import es.princip.getp.domain.people.model.PeopleId;

public interface CheckPeopleLikePort {

boolean existsBy(MemberId memberId, PeopleId peopleId);

Boolean existsBy(Member member, PeopleId peopleId);
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package es.princip.getp.application.people.port.in;

import es.princip.getp.api.controller.people.query.dto.people.MyPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.peopleProfile.DetailPeopleProfileResponse;
import es.princip.getp.api.controller.people.query.dto.peopleProfile.PeopleProfileDetailResponse;
import es.princip.getp.domain.member.model.MemberId;

public interface GetMyPeopleQuery {

MyPeopleResponse getBy(MemberId memberId);

DetailPeopleProfileResponse getDetailProfileBy(MemberId memberId);
PeopleProfileDetailResponse getDetailProfileBy(MemberId memberId);
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package es.princip.getp.application.people.port.in;

import es.princip.getp.api.controller.people.query.dto.people.CardPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.people.DetailPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.people.PublicDetailPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.people.PeopleDetailResponse;
import es.princip.getp.application.people.command.GetPeopleCommand;
import es.princip.getp.domain.member.model.MemberId;
import es.princip.getp.domain.member.model.Member;
import es.princip.getp.domain.people.model.PeopleId;
import org.springframework.data.domain.Page;

public interface GetPeopleQuery {

Page<CardPeopleResponse> getPagedCards(GetPeopleCommand command);

DetailPeopleResponse getDetailBy(MemberId memberId, PeopleId peopleId);

PublicDetailPeopleResponse getPublicDetailBy(PeopleId peopleId);
PeopleDetailResponse getDetailBy(Member member, PeopleId peopleId);
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package es.princip.getp.application.people.port.out;

import es.princip.getp.api.controller.people.query.dto.people.MyPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.peopleProfile.DetailPeopleProfileResponse;
import es.princip.getp.api.controller.people.query.dto.peopleProfile.PeopleProfileDetailResponse;
import es.princip.getp.domain.member.model.MemberId;

public interface FindMyPeoplePort {

MyPeopleResponse findBy(MemberId memberId);

DetailPeopleProfileResponse findDetailProfileBy(MemberId memberId);
PeopleProfileDetailResponse findDetailProfileBy(MemberId memberId);
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package es.princip.getp.application.people.port.out;

import es.princip.getp.api.controller.people.query.dto.people.CardPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.people.DetailPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.people.PublicDetailPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.people.PeopleDetailResponse;
import es.princip.getp.application.people.command.PeopleSearchFilter;
import es.princip.getp.domain.member.model.Member;
import es.princip.getp.domain.member.model.MemberId;
import es.princip.getp.domain.people.model.PeopleId;
import org.springframework.data.domain.Page;
Expand All @@ -13,7 +13,5 @@ public interface FindPeoplePort {

Page<CardPeopleResponse> findCardBy(Pageable pageable, PeopleSearchFilter filter, MemberId memberId);

DetailPeopleResponse findDetailBy(MemberId memberId, PeopleId peopleId);

PublicDetailPeopleResponse findPublicDetailBy(PeopleId peopleId);
PeopleDetailResponse findDetailBy(Member member, PeopleId peopleId);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package es.princip.getp.application.people.service;

import es.princip.getp.api.controller.people.query.dto.people.MyPeopleResponse;
import es.princip.getp.api.controller.people.query.dto.peopleProfile.DetailPeopleProfileResponse;
import es.princip.getp.api.controller.people.query.dto.peopleProfile.PeopleProfileDetailResponse;
import es.princip.getp.application.people.port.in.GetMyPeopleQuery;
import es.princip.getp.application.people.port.out.FindMyPeoplePort;
import es.princip.getp.domain.member.model.MemberId;
Expand All @@ -22,7 +22,7 @@ public MyPeopleResponse getBy(final MemberId memberId) {
}

@Override
public DetailPeopleProfileResponse getDetailProfileBy(final MemberId memberId) {
public PeopleProfileDetailResponse getDetailProfileBy(final MemberId memberId) {
return findMyPeoplePort.findDetailProfileBy(memberId);
}
}
Loading