Skip to content

Commit

Permalink
Merge pull request #127 from dnd-side-project/feat/#126
Browse files Browse the repository at this point in the history
λ‚΄κ°€ 받은 섀문에 μž‘μ„±μž wikiId 포함(#126)
  • Loading branch information
rlacksgus97 authored Mar 18, 2024
2 parents b05f59d + e9de068 commit 1e88bd7
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import com.dnd.namuiwiki.domain.survey.model.entity.Survey;
import com.dnd.namuiwiki.domain.survey.type.Period;
import com.dnd.namuiwiki.domain.survey.type.Relation;
import com.dnd.namuiwiki.domain.user.entity.User;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Optional;

@Getter
@AllArgsConstructor
public class ReceivedSurveyDto {
Expand All @@ -14,13 +17,21 @@ public class ReceivedSurveyDto {
private Relation relation;
private Period period;
private String senderName;
private String senderWikiId;

public static ReceivedSurveyDto from(Survey survey) {
String senderWikiId = null;
User sender = survey.getSender();
if (sender != null) {
senderWikiId = sender.getWikiId();
}

return new ReceivedSurveyDto(
survey.getId(),
survey.getRelation(),
survey.getPeriod(),
survey.getSenderName()
survey.getSenderName(),
senderWikiId
);
}

Expand Down

0 comments on commit 1e88bd7

Please sign in to comment.