Skip to content

Commit

Permalink
#82 feat : apply 엔티티 -> Dto 매퍼 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
rivkode committed Apr 24, 2024
1 parent a1f7335 commit fe1f9f9
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.seoultech.synergybe.domain.apply.service;

import com.seoultech.synergybe.domain.apply.Apply;
import com.seoultech.synergybe.domain.apply.dto.response.GetApplyResponse;
import com.seoultech.synergybe.domain.apply.dto.response.GetApplyUserResponse;
import com.seoultech.synergybe.domain.apply.dto.response.GetListApplyResponse;
import com.seoultech.synergybe.domain.apply.dto.response.GetListApplyUserResponse;
import com.seoultech.synergybe.domain.user.User;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.List;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ApplyMapperEntityToDto {
public static GetListApplyResponse applyListToResponse(
List<Apply> applyList
) {
List<GetApplyResponse> getApplyResponses = applyList.stream()
.map(result -> new GetApplyResponse(
result.getId(),
result.getStatus()))
.toList();
return new GetListApplyResponse(getApplyResponses);
}

public static GetListApplyUserResponse userListToResponse(
List<User> userList
) {
List<GetApplyUserResponse> getApplyUserResponses = userList.stream()
.map(GetApplyUserResponse::new)
.toList();
return new GetListApplyUserResponse(getApplyUserResponses);
}
}

0 comments on commit fe1f9f9

Please sign in to comment.