add migration; insert 'deleted' column in booking change incidents table
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
up: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.addColumn('bookingChangeIncidents', 'deleted', {
|
||||||
|
type: Sequelize.BOOLEAN,
|
||||||
|
defaultValue: false,
|
||||||
|
after: 'chargeFee',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
down: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.removeColumn('bookingChangeIncidents', 'deleted');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -12,6 +12,7 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
newBookingEnd: DataTypes.DATE,
|
newBookingEnd: DataTypes.DATE,
|
||||||
incidentType: DataTypes.INTEGER,
|
incidentType: DataTypes.INTEGER,
|
||||||
chargeFee: DataTypes.FLOAT,
|
chargeFee: DataTypes.FLOAT,
|
||||||
|
deleted: DataTypes.BOOLEAN,
|
||||||
}, {});
|
}, {});
|
||||||
bookingChangeIncident.associate = function(models) {
|
bookingChangeIncident.associate = function(models) {
|
||||||
// associations can be defined here
|
// associations can be defined here
|
||||||
|
|||||||
@@ -136,7 +136,9 @@ const getBookingChangeIncidents = (startDate, endDate, memberIds) => {
|
|||||||
'createdAt'
|
'createdAt'
|
||||||
];
|
];
|
||||||
|
|
||||||
const filters = {};
|
const filters = {
|
||||||
|
deleted: false,
|
||||||
|
};
|
||||||
|
|
||||||
if (startDate && endDate) {
|
if (startDate && endDate) {
|
||||||
filters.createdAt = {
|
filters.createdAt = {
|
||||||
@@ -280,6 +282,7 @@ const getAllIncidents = (dateRange, memberIds) => {
|
|||||||
newBookingEnd,
|
newBookingEnd,
|
||||||
incidentType,
|
incidentType,
|
||||||
chargeFee,
|
chargeFee,
|
||||||
|
deleted,
|
||||||
createdAt,
|
createdAt,
|
||||||
} = bookingChangeIncident;
|
} = bookingChangeIncident;
|
||||||
const memberName = membersMap[memberId].name;
|
const memberName = membersMap[memberId].name;
|
||||||
@@ -307,6 +310,7 @@ const getAllIncidents = (dateRange, memberIds) => {
|
|||||||
newBookingEndRaw: newBookingEnd,
|
newBookingEndRaw: newBookingEnd,
|
||||||
incidentType,
|
incidentType,
|
||||||
totalChargeFee: chargeFee,
|
totalChargeFee: chargeFee,
|
||||||
|
deleted,
|
||||||
incidentTimestamp: formatTime(createdAt),
|
incidentTimestamp: formatTime(createdAt),
|
||||||
incidentTimestampRaw: createdAt,
|
incidentTimestampRaw: createdAt,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user