UNPKG

@golemio/parkings

Version:
29 lines 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ParkingPaymentsRepository = void 0; const _sch_1 = require("../../schema-definitions"); const PaymentModel_1 = require("../../schema-definitions/models/PaymentModel"); const integration_engine_1 = require("@golemio/core/dist/integration-engine"); const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator"); const sequelize_1 = require("@golemio/core/dist/shared/sequelize"); class ParkingPaymentsRepository extends integration_engine_1.PostgresModel { constructor() { super("ParkingPaymentsRepository", { outputSequelizeAttributes: PaymentModel_1.PaymentModel.attributeModel, pgSchema: _sch_1.Parkings.pgSchema, pgTableName: PaymentModel_1.PaymentModel.tableName, savingType: "insertOrUpdate", }, new golemio_validator_1.JSONSchemaValidator("ParkingPaymentsRepositoryValidator", PaymentModel_1.PaymentModel.jsonSchema)); } async updatePaymentsBySource(payments, source, processingDate) { await this.bulkSave(payments, PaymentModel_1.PaymentModel.attributeUpdateList); await this.sequelizeModel.destroy({ where: { source: { [sequelize_1.Op.eq]: source }, updated_at: { [sequelize_1.Op.lt]: processingDate }, }, }); } } exports.ParkingPaymentsRepository = ParkingPaymentsRepository; //# sourceMappingURL=ParkingPaymentsRepository.js.map