Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import jakarta.validation.constraints.NotBlank;

public record ProfileImageRequest(
@NotBlank String fileName,
@NotBlank String filePath
String fileName,
String filePath
) {
public ProfileImage toEntity() {
return ProfileImage.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package es.princip.ringus.presentation.common.dto;

import es.princip.ringus.infra.storage.domain.ProfileImage;

public record ProfileImageResponse(
String fileName,
String filePath
) {
public static ProfileImageResponse from(final ProfileImage profileImage) {
return new ProfileImageResponse(
profileImage.getFileName(),
profileImage.getFilePath()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import es.princip.ringus.domain.mentee.Mentee;
import es.princip.ringus.presentation.common.dto.EducationResponse;
import es.princip.ringus.presentation.common.dto.ProfileImageResponse;

public record MenteeProfileResponse(
String nickname,
String imgUrl,
ProfileImageResponse image,
EducationResponse education
) {
public static MenteeProfileResponse from(final Mentee mentee) {
return new MenteeProfileResponse(mentee.getNickname(), mentee.getProfileImage().getFilePath(), EducationResponse.from(mentee.getEducation()));
return new MenteeProfileResponse(mentee.getNickname(), ProfileImageResponse.from(mentee.getProfileImage()), EducationResponse.from(mentee.getEducation()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import es.princip.ringus.domain.mentor.Mentor;
import es.princip.ringus.presentation.common.dto.OrganizationResponse;
import es.princip.ringus.presentation.common.dto.ProfileImageResponse;

public record MentorProfileResponse(
String nickname,
String imgUrl,
OrganizationResponse organization
ProfileImageResponse image,
OrganizationResponse organization,
int mentoringCount
) {
public static MentorProfileResponse from(final Mentor mentor){
return new MentorProfileResponse(mentor.getNickname(), mentor.getProfileImage().getFilePath(), OrganizationResponse.from(mentor.getOrganization()));
return new MentorProfileResponse(mentor.getNickname(), ProfileImageResponse.from(mentor.getProfileImage()), OrganizationResponse.from(mentor.getOrganization()),0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import es.princip.ringus.infra.storage.domain.ProfileImage;
import es.princip.ringus.presentation.common.dto.ProfileImageResponse;

public record MenteeCardResponse(
Long menteeId,
String nickname,
String imgUrl,
ProfileImageResponse image,
@JsonInclude(NON_NULL) String status
) {
public static MenteeCardResponse of(
Expand All @@ -20,7 +21,7 @@ public static MenteeCardResponse of(
return new MenteeCardResponse(
menteeId,
nickname,
profileImage.getFilePath(),
ProfileImageResponse.from(profileImage),
status
);
}
Expand All @@ -34,7 +35,7 @@ public static MenteeCardResponse of(
return new MenteeCardResponse(
menteeId,
nickname,
profileImage.getFilePath(),
ProfileImageResponse.from(profileImage),
null
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

import es.princip.ringus.domain.mentee.Mentee;
import es.princip.ringus.presentation.common.dto.EducationResponse;
import es.princip.ringus.presentation.common.dto.ProfileImageResponse;

public record MyMenteeResponse(
String nickname,
EducationResponse education,
String introduction,
String imgUrl
ProfileImageResponse image
) {
public static MyMenteeResponse from(final Mentee mentee) {
return new MyMenteeResponse(
mentee.getNickname(),
EducationResponse.from(mentee.getEducation()),
mentee.getIntroduction(),
mentee.getProfileImage().getFilePath()
ProfileImageResponse.from(mentee.getProfileImage())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import es.princip.ringus.infra.storage.domain.ProfileImage;
import es.princip.ringus.presentation.common.dto.IntroductionResponse;
import es.princip.ringus.presentation.common.dto.OrganizationResponse;
import es.princip.ringus.presentation.common.dto.ProfileImageResponse;

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

public record MentorCardResponse(
Long mentorId,
String nickname,
String imgUrl,
ProfileImageResponse image,
IntroductionResponse introduction,
OrganizationResponse organization,
String message,
Expand All @@ -30,7 +31,7 @@ public static MentorCardResponse of(
return new MentorCardResponse(
mentorId,
nickname,
profileImage.getFilePath(),
ProfileImageResponse.from(profileImage),
IntroductionResponse.from(introduction),
OrganizationResponse.from(organization),
null,
Expand All @@ -51,7 +52,7 @@ public static MentorCardResponse of(
return new MentorCardResponse(
mentorId,
nickname,
profileImage.getFilePath(),
ProfileImageResponse.from(profileImage),
IntroductionResponse.from(introduction),
OrganizationResponse.from(organization),
message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public record MyMentorResponse(
Set<String> mentoringField,
List<String> hashtags,
String message,
PortfolioResponse portfolio
PortfolioResponse portfolio,
int mentoringCount
) {
public static MyMentorResponse from(final Mentor mentor) {
return new MyMentorResponse(
Expand All @@ -29,7 +30,8 @@ public static MyMentorResponse from(final Mentor mentor) {
mentor.getMentoringField().stream().map(String::valueOf).collect(Collectors.toSet()),
mentor.getHashtags().stream().map(Hashtag::getValue).toList(),
mentor.getMessage(),
PortfolioResponse.from(mentor.getPortfolio())
PortfolioResponse.from(mentor.getPortfolio()),
0
);
}
}