28 lines
1 KiB
TypeScript
28 lines
1 KiB
TypeScript
import { newsletterRecipients } from "../../entity/newsletterRecipients";
|
|
import { NewsletterRecipientsViewModel } from "../../viewmodel/admin/newsletterRecipients.models";
|
|
import MemberFactory from "./member";
|
|
|
|
export default abstract class NewsletterRecipientsFactory {
|
|
/**
|
|
* @description map record to newsletterRecipients
|
|
* @param {newsletterRecipients} record
|
|
* @returns {NewsletterRecipientsViewModel}
|
|
*/
|
|
public static mapToSingle(record: newsletterRecipients): NewsletterRecipientsViewModel {
|
|
return {
|
|
newsletterId: record.newsletterId,
|
|
memberId: record.memberId,
|
|
addedManually: record.addedManually,
|
|
member: MemberFactory.mapToSingle(record.member),
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @description map records to newsletterRecipients
|
|
* @param {Array<newsletterRecipients>} records
|
|
* @returns {Array<NewsletterRecipientsViewModel>}
|
|
*/
|
|
public static mapToBase(records: Array<newsletterRecipients>): Array<NewsletterRecipientsViewModel> {
|
|
return records.map((r) => this.mapToSingle(r));
|
|
}
|
|
}
|