28 lines
975 B
TypeScript
28 lines
975 B
TypeScript
import { protocolPresence } from "../../../../entity/club/protocol/protocolPresence";
|
|
import { ProtocolPresenceViewModel } from "../../../../viewmodel/admin/club/protocol/protocolPresence.models";
|
|
import MemberFactory from "../member/member";
|
|
|
|
export default abstract class ProtocolPresenceFactory {
|
|
/**
|
|
* @description map record to protocolPresence
|
|
* @param {protocol} record
|
|
* @returns {ProtocolPresenceViewModel}
|
|
*/
|
|
public static mapToSingle(record: protocolPresence): ProtocolPresenceViewModel {
|
|
return {
|
|
memberId: record.member.id,
|
|
absent: record.absent,
|
|
excused: record.excused,
|
|
protocolId: record.protocolId,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @description map records to protocolPresence
|
|
* @param {Array<protocol>} records
|
|
* @returns {Array<ProtocolPresenceViewModel>}
|
|
*/
|
|
public static mapToBase(records: Array<protocolPresence>): Array<ProtocolPresenceViewModel> {
|
|
return records.map((r) => this.mapToSingle(r));
|
|
}
|
|
}
|