add deleteFees route and implement logic
This commit is contained in:
@@ -274,6 +274,16 @@ const deleteBookingChangeIncidents = (incidents) => {
|
||||
return Promise.all(asyncActions);
|
||||
};
|
||||
|
||||
const deleteBookingChangeIncidentsById = (incidentIds) => {
|
||||
console.log('Delete booking changes in DB :', incidentIds);
|
||||
const filters = {
|
||||
id: {
|
||||
[Op.in]: incidentIds
|
||||
}
|
||||
};
|
||||
return db.bookingChangeIncident.update({deleted: true},{where: filters});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getChargedCanceledReservations,
|
||||
getIncidentsFromChanges,
|
||||
@@ -281,4 +291,5 @@ module.exports = {
|
||||
getShorteningIncidentsForReservationId,
|
||||
getReservationsIncidentsForRemoval,
|
||||
deleteBookingChangeIncidents,
|
||||
deleteBookingChangeIncidentsById
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
const moment = require('moment-timezone');
|
||||
const db = require('../../models/index');
|
||||
const Op = require('sequelize').Op;
|
||||
|
||||
const {
|
||||
doorLockEvents,
|
||||
@@ -69,6 +70,16 @@ const insertUnscheduledIncidents = (incidents) => {
|
||||
return Promise.all(asyncJobs);
|
||||
};
|
||||
|
||||
const deleteUnscheduledIncidentsById = (incidentIds) => {
|
||||
console.log('Delete unscheduled in DB :', incidentIds);
|
||||
const filters = {
|
||||
id: {
|
||||
[Op.in]: incidentIds
|
||||
}
|
||||
};
|
||||
return db.unscheduledIncident.update({deleted: true},{where: filters});
|
||||
};
|
||||
|
||||
const insertUnlockedIncidents = (incidents) => {
|
||||
const asyncJobs = [];
|
||||
incidents.forEach((incident) => {
|
||||
@@ -104,6 +115,16 @@ const insertUnlockedIncidents = (incidents) => {
|
||||
return Promise.all(asyncJobs);
|
||||
};
|
||||
|
||||
const deleteUnlockedIncidentsById = (incidentIds) => {
|
||||
console.log('Delete unlocked in DB :', incidentIds);
|
||||
const filters = {
|
||||
id: {
|
||||
[Op.in]: incidentIds
|
||||
}
|
||||
};
|
||||
return db.unlockedIncident.update({deleted: true},{where: filters});
|
||||
};
|
||||
|
||||
const setUnlockedIncidentsLevel = (incidents) => {
|
||||
return new Promise ((resolve, reject) => {
|
||||
const sortingFunction = (incidentA, incidentB) => {
|
||||
@@ -576,5 +597,7 @@ const calculateDoorLockCharges = () => {
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
calculateDoorLockCharges
|
||||
calculateDoorLockCharges,
|
||||
deleteUnlockedIncidentsById,
|
||||
deleteUnscheduledIncidentsById
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user