@tomei/rental
Version:
Tomei Rental Package
52 lines • 1.81 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RentalPriceRepository = void 0;
const general_1 = require("@tomei/general");
const rental_price_entity_1 = require("../../models/rental-price.entity");
class RentalPriceRepository extends general_1.RepositoryBase {
constructor() {
super(rental_price_entity_1.RentalPriceModel);
}
async findByPk(id, transaction) {
try {
const result = await rental_price_entity_1.RentalPriceModel.findByPk(id, {
transaction: transaction,
});
return result;
}
catch (error) {
throw new Error(`An Error occured when fetching : ${error.message}`);
}
}
async delete(RentalPriceId, dbTransaction) {
try {
const options = {
where: {
RentalPriceId: RentalPriceId,
},
transaction: dbTransaction,
};
await rental_price_entity_1.RentalPriceModel.destroy(options);
}
catch (error) {
throw new Error(`An Error occured when delete : ${error.message}`);
}
}
async findAndCountAll(options) {
try {
let RentalPrices;
if (options) {
RentalPrices = await rental_price_entity_1.RentalPriceModel.findAndCountAll(options);
}
else {
RentalPrices = await rental_price_entity_1.RentalPriceModel.findAndCountAll();
}
return RentalPrices;
}
catch (error) {
throw new Error(`An Error occured when retriving : ${error.message}`);
}
}
}
exports.RentalPriceRepository = RentalPriceRepository;
//# sourceMappingURL=rental-price.repository.js.map