27 lines
896 B
TypeScript
27 lines
896 B
TypeScript
import { protocolPresence } from "../../entity/protocolPresence";
|
|
import { ProtocolPresenceViewModel } from "../../viewmodel/admin/protocolPresence.models";
|
|
import MemberFactory from "./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,
|
|
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));
|
|
}
|
|
}
|