-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(approve-reject-booking): Approving and Rejecting Bookings
- add statusId to booking field - create route for filtering bookings by status - create a patch route to approve/reject bookings - create tests for this feature [Finishes #169469640]
- Loading branch information
1 parent
e03599f
commit 4874cb0
Showing
32 changed files
with
725 additions
and
101 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/database/migrations/20191105142130-addStatusIdBooking.js.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => queryInterface.sequelize.transaction(t => Promise.all([ | ||
queryInterface.addColumn('bookings', 'statusId', { | ||
type: Sequelize.INTEGER, | ||
allowNull: false | ||
}, { transaction: t }), | ||
])), | ||
|
||
down: queryInterface => queryInterface.sequelize.transaction(t => Promise.all([ | ||
queryInterface.removeColumn('bookings', 'statusId', { transaction: t }), | ||
])), | ||
}; |
36 changes: 36 additions & 0 deletions
36
src/database/migrations/20191105174610-create-bookingnotifications.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('bookingnotifications', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
bookingId: { | ||
type: Sequelize.INTEGER | ||
}, | ||
userNotified: { | ||
type: Sequelize.INTEGER | ||
}, | ||
activity: { | ||
type: Sequelize.STRING | ||
}, | ||
isRead: { | ||
type: Sequelize.BOOLEAN | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATEONLY | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATEONLY | ||
} | ||
}); | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('bookingnotifications'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
module.exports = (sequelize, DataTypes) => { | ||
const bookingnotifications = sequelize.define('bookingnotifications', { | ||
bookingId: DataTypes.INTEGER, | ||
userNotified: DataTypes.INTEGER, | ||
activity: DataTypes.STRING, | ||
isRead: { | ||
type: DataTypes.BOOLEAN, | ||
defaultValue: false, | ||
}, | ||
}, { | ||
tableName: 'bookingnotifications' | ||
}); | ||
bookingnotifications.associate = function(models) { | ||
// associations can be defined here | ||
bookingnotifications.belongsTo(models.booking, { | ||
as: 'booking', | ||
foreignKey: 'bookingId', | ||
}); | ||
bookingnotifications.belongsTo(models.users, { | ||
as: 'notifiedUser', | ||
foreignKey: 'userNotified' | ||
}); | ||
}; | ||
return bookingnotifications; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.