@tomei/rental
Version:
Tomei Rental Package
63 lines • 2.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HirerChangeRequestRemoveHirerRepository = void 0;
const general_1 = require("@tomei/general");
const hirer_change_request_remove_hirer_entity_1 = require("../../models/hirer-change-request-remove-hirer.entity");
class HirerChangeRequestRemoveHirerRepository extends general_1.RepositoryBase {
constructor() {
super(hirer_change_request_remove_hirer_entity_1.HirerChangeRequestRemoveHirerModel);
}
async findByPk(id, transaction) {
try {
const result = await hirer_change_request_remove_hirer_entity_1.HirerChangeRequestRemoveHirerModel.findByPk(id, {
transaction: transaction,
});
return result;
}
catch (error) {
throw new Error(`An Error occured when fetching : ${error.message}`);
}
}
async delete(removeHirerId, dbTransaction) {
try {
const options = {
where: {
RemoveHirerId: removeHirerId,
},
transaction: dbTransaction,
};
await hirer_change_request_remove_hirer_entity_1.HirerChangeRequestRemoveHirerModel.destroy(options);
}
catch (error) {
throw new Error(`An Error occured when delete : ${error.message}`);
}
}
async findAndCountAll(options) {
try {
let hcrRemoveHirers;
if (options) {
hcrRemoveHirers =
await hirer_change_request_remove_hirer_entity_1.HirerChangeRequestRemoveHirerModel.findAndCountAll(options);
}
else {
hcrRemoveHirers =
await hirer_change_request_remove_hirer_entity_1.HirerChangeRequestRemoveHirerModel.findAndCountAll();
}
return hcrRemoveHirers;
}
catch (error) {
throw new Error(`An Error occured when retriving : ${error.message}`);
}
}
async findAll(options) {
try {
const result = await hirer_change_request_remove_hirer_entity_1.HirerChangeRequestRemoveHirerModel.findAll(options);
return result;
}
catch (error) {
throw new Error(`An Error occured when fetching : ${error.message}`);
}
}
}
exports.HirerChangeRequestRemoveHirerRepository = HirerChangeRequestRemoveHirerRepository;
//# sourceMappingURL=hirer-change-request-remove-hirer.repository.js.map