diff --git a/src/main/java/com/careerzip/global/admin/dto/response/ContactSummary.java b/src/main/java/com/careerzip/global/admin/dto/response/ContactSummary.java new file mode 100644 index 0000000..76ca17c --- /dev/null +++ b/src/main/java/com/careerzip/global/admin/dto/response/ContactSummary.java @@ -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 listOf(List accounts) { + return accounts.stream() + .map(ContactSummary::from) + .collect(Collectors.toList()); + } +} diff --git a/src/main/java/com/careerzip/global/newsletter/dto/request/CampaignRequest.java b/src/main/java/com/careerzip/global/newsletter/dto/request/CampaignRequest.java new file mode 100644 index 0000000..3925446 --- /dev/null +++ b/src/main/java/com/careerzip/global/newsletter/dto/request/CampaignRequest.java @@ -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); + } +} diff --git a/src/main/java/com/careerzip/global/newsletter/dto/request/ContactRequest.java b/src/main/java/com/careerzip/global/newsletter/dto/request/ContactRequest.java new file mode 100644 index 0000000..1c19279 --- /dev/null +++ b/src/main/java/com/careerzip/global/newsletter/dto/request/ContactRequest.java @@ -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 listOf(List accounts) { + return accounts.stream() + .map(ContactRequest::from) + .collect(Collectors.toList()); + } +}