2020-05-05 09:54:02 +00:00
|
|
|
const db = require('../../data/db');
|
|
|
|
|
|
|
|
module.exports = {
|
2020-06-02 14:51:42 +00:00
|
|
|
addAvailability,
|
|
|
|
deleteAvailability,
|
2020-05-05 09:54:02 +00:00
|
|
|
};
|
|
|
|
|
2020-06-02 14:51:42 +00:00
|
|
|
function addAvailability(data) {
|
|
|
|
return db('availability')
|
2020-05-05 09:54:02 +00:00
|
|
|
.insert(data)
|
2020-05-05 14:18:36 +00:00
|
|
|
.returning([
|
|
|
|
'id',
|
2020-08-28 12:08:13 +00:00
|
|
|
'participant_id',
|
2020-05-06 13:33:38 +00:00
|
|
|
'possible_date_id',
|
2020-05-05 14:18:36 +00:00
|
|
|
'preference',
|
|
|
|
'start_time',
|
|
|
|
'end_time',
|
|
|
|
]);
|
2020-05-05 09:54:02 +00:00
|
|
|
}
|
|
|
|
|
2020-06-02 14:51:42 +00:00
|
|
|
function deleteAvailability(id) {
|
|
|
|
return db('availability').where({ id }).del();
|
2020-05-05 09:54:02 +00:00
|
|
|
}
|