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