removed seed for holidays and slots

This commit is contained in:
Kfir Dayan 2023-04-26 13:36:21 +03:00
parent 53dd3ada4f
commit 4cdafde55c
2 changed files with 1 additions and 36 deletions

View file

@ -32,6 +32,7 @@ export const timeslotsHandler = async (req: Request, res: Response) => {
export const deliveriesHandler = (req: Request, res: Response) => {
// TODO: Implement deliveries functionality
};
export const cancelDeliveryHandler = (req: Request, res: Response) => {

View file

@ -1,36 +0,0 @@
exports.seed = async function(knex) {
// Delete all existing data from the tables
// check is table exists first
const hasTable = await knex.schema.hasTable('timeslots');
if (hasTable) {
await knex('timeslots').del();
}
// Load data from the JSON files
const holidays = require('../data/holidays.json');
const timeslots = require('../data/timeslots.json');
console.log(holidays)
// Insert the holiday dates into the holidays table
for (const date of holidays) {
console.log(date)
await knex('holidays').insert( {
name: "test",
date: "2020-12-25",
country: "US"
} );
}
// Insert the time slots into the timeslots table
for (const { date, slots } of timeslots) {
for (const slot of slots) {
await knex('timeslots').insert({
date,
start_time: slot.start_time,
end_time: slot.end_time
});
}
}
};