UNPKG

@tomei/rental

Version:
52 lines 1.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.JointHirerRepository = void 0; const general_1 = require("@tomei/general"); const joint_hirer_entity_1 = require("../../models/joint-hirer.entity"); class JointHirerRepository extends general_1.RepositoryBase { constructor() { super(joint_hirer_entity_1.JointHirerModel); } async findByPk(id, transaction) { try { const result = await joint_hirer_entity_1.JointHirerModel.findByPk(id, { transaction: transaction, }); return result; } catch (error) { throw new Error(`An Error occured when fetching : ${error.message}`); } } async delete(hirerId, dbTransaction) { try { const options = { where: { HirerId: hirerId, }, transaction: dbTransaction, }; await joint_hirer_entity_1.JointHirerModel.destroy(options); } catch (error) { throw new Error(`An Error occured when delete : ${error.message}`); } } async findAndCountAll(options) { try { let jointHirers; if (options) { jointHirers = await joint_hirer_entity_1.JointHirerModel.findAndCountAll(options); } else { jointHirers = await joint_hirer_entity_1.JointHirerModel.findAndCountAll(); } return jointHirers; } catch (error) { throw new Error(`An Error occured when retriving : ${error.message}`); } } } exports.JointHirerRepository = JointHirerRepository; //# sourceMappingURL=joint-hirer.repository.js.map