28 lines
849 B
TypeScript
28 lines
849 B
TypeScript
|
import { protocolAgenda } from "../../entity/protocolAgenda";
|
||
|
import { ProtocolAgendaViewModel } from "../../viewmodel/admin/protocolAgenda.models";
|
||
|
|
||
|
export default abstract class ProtocolAgendaFactory {
|
||
|
/**
|
||
|
* @description map record to protocolAgenda
|
||
|
* @param {protocol} record
|
||
|
* @returns {ProtocolAgendaViewModel}
|
||
|
*/
|
||
|
public static mapToSingle(record: protocolAgenda): ProtocolAgendaViewModel {
|
||
|
return {
|
||
|
id: record.id,
|
||
|
topic: record.topic,
|
||
|
context: record.context,
|
||
|
protocolId: record.protocol.id,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @description map records to protocolAgenda
|
||
|
* @param {Array<protocol>} records
|
||
|
* @returns {Array<ProtocolAgendaViewModel>}
|
||
|
*/
|
||
|
public static mapToBase(records: Array<protocolAgenda>): Array<ProtocolAgendaViewModel> {
|
||
|
return records.map((r) => this.mapToSingle(r));
|
||
|
}
|
||
|
}
|