Skip to content

Commit

Permalink
Feat: Main Camapaign Contact 등록 요청 DTO 구현
Browse files Browse the repository at this point in the history
[#45]
  • Loading branch information
MuseopKim committed Jun 27, 2021
1 parent 4c738c9 commit 022a481
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.careerzip.global.admin.dto.response;

import com.careerzip.domain.account.entity.Account;
import lombok.Builder;
import lombok.Getter;

import java.util.List;
import java.util.stream.Collectors;

@Getter
public class ContactSummary {

private final String name;
private final String email;

@Builder
private ContactSummary(String name, String email) {
this.name = name;
this.email = email;
}

public static ContactSummary from(Account account) {
return ContactSummary.builder()
.name(account.getName())
.email(account.getEmail())
.build();
}

public static List<ContactSummary> listOf(List<Account> accounts) {
return accounts.stream()
.map(ContactSummary::from)
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.careerzip.global.newsletter.dto.request;

import lombok.Getter;

@Getter
public class CampaignRequest {

private final String campaignId;

private CampaignRequest(String campaignId) {
this.campaignId = campaignId;
}

public static CampaignRequest from(String campaignId) {
return new CampaignRequest(campaignId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.careerzip.global.newsletter.dto.request;

import com.careerzip.domain.account.entity.Account;
import lombok.Builder;
import lombok.Getter;

import java.util.List;
import java.util.stream.Collectors;

@Getter
public class ContactRequest {

private final CampaignRequest campaign;
private final String name;
private final String email;

@Builder
private ContactRequest(CampaignRequest campaign, String name, String email) {
this.campaign = campaign;
this.name = name;
this.email = email;
}

public static ContactRequest from(Account account) {
return ContactRequest.builder()
.campaign(CampaignRequest.from("zKaDh"))
.name(account.getName())
.email(account.getEmail())
.build();
}

public static List<ContactRequest> listOf(List<Account> accounts) {
return accounts.stream()
.map(ContactRequest::from)
.collect(Collectors.toList());
}
}

0 comments on commit 022a481

Please sign in to comment.