UNPKG

@tomei/rental

Version:
67 lines 2.83 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; 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); } findByPk(id, transaction) { return __awaiter(this, void 0, void 0, function* () { try { const result = yield rental_price_entity_1.RentalPriceModel.findByPk(id, { transaction: transaction, }); return result; } catch (error) { throw new Error(`An Error occured when fetching : ${error.message}`); } }); } delete(RentalPriceId, dbTransaction) { return __awaiter(this, void 0, void 0, function* () { try { const options = { where: { RentalPriceId: RentalPriceId, }, transaction: dbTransaction, }; yield rental_price_entity_1.RentalPriceModel.destroy(options); } catch (error) { throw new Error(`An Error occured when delete : ${error.message}`); } }); } findAndCountAll(options) { return __awaiter(this, void 0, void 0, function* () { try { let RentalPrices; if (options) { RentalPrices = yield rental_price_entity_1.RentalPriceModel.findAndCountAll(options); } else { RentalPrices = yield 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