From 931d41d04c26f515189293e428a6f9840bd36d6f Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Wed, 26 Apr 2023 13:41:54 +0300 Subject: [PATCH] removed unused code --- src/data/timeSlots.json | 4 +++ src/index.ts | 50 -------------------------------- src/services/timeslotsService.ts | 2 +- src/types/index.ts | 1 + 4 files changed, 6 insertions(+), 51 deletions(-) diff --git a/src/data/timeSlots.json b/src/data/timeSlots.json index 069a62f..fc43c7f 100644 --- a/src/data/timeSlots.json +++ b/src/data/timeSlots.json @@ -1,6 +1,7 @@ { "courier_available_timeslots": [ { + "id": 1, "start_time": "2023-09-17 08:00:00", "end_time": "2023-09-17 09:00:00", "supported_postcodes": [ @@ -9,6 +10,7 @@ ] }, { + "id": 2, "start_time": "2023-09-17 09:00:00", "end_time": "2023-09-17 10:00:00", "supported_postcodes": [ @@ -18,6 +20,7 @@ ] }, { + "id": 3, "start_time": "2023-09-17 09:00:00", "end_time": "2023-09-17 10:00:00", "supported_postcodes": [ @@ -27,6 +30,7 @@ ] }, { + "id": 4, "start_time": "2023-09-18 14:00:00", "end_time": "2023-09-18 15:00:00", "supported_postcodes": [ diff --git a/src/index.ts b/src/index.ts index 17a358f..3359453 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,59 +1,9 @@ import app from './app'; -import fs from 'fs'; const env = process.env.NODE_ENV || 'development'; const PORT = process.env.PORT || 3000; app.listen(PORT, () => { console.log("STARTING ... ") - if (env === 'development') { - console.log("Generating mock data files") - // generateMockDataFiles(); - } console.log(`Server is running on port ${PORT}`); }); - - -// const generateMockDataFiles = () => { - -// if (!fs.existsSync('./data')) { -// fs.mkdirSync('./data'); -// } - -// if (!fs.existsSync('./data/timeSlots.json')) { -// const timeSlots = { -// timeSlots: [ -// "08:00 - 10:00", -// "10:00 - 12:00", -// "12:00 - 14:00", -// "14:00 - 16:00", -// "16:00 - 18:00", -// "18:00 - 20:00" -// ] -// } -// fs.writeFileSync('./data/timeSlots.json', JSON.stringify(timeSlots)); -// } - -// if (!fs.existsSync('./data/holidays.json')) { -// const holidays = { -// "holidays": [ -// { -// "name": "New Year's Day", -// "date": "2023-01-17", -// "country": "US" -// }, -// { -// "name": "Mother's Day", -// "date": "2023-09-18", -// "country": "US" -// }, -// { -// "name": "Independence Day", -// "date": "2023-10-17", -// "country": "US" -// } -// ] -// } -// fs.writeFileSync('./data/holidays.json', JSON.stringify(holidays)); -// } -// } \ No newline at end of file diff --git a/src/services/timeslotsService.ts b/src/services/timeslotsService.ts index b388e87..68e2213 100644 --- a/src/services/timeslotsService.ts +++ b/src/services/timeslotsService.ts @@ -3,4 +3,4 @@ import timeSlots from '../data/timeslots.json'; export function getAvailableTimeSlots() { return Promise.resolve(timeSlots); -} \ No newline at end of file +} \ No newline at end of file diff --git a/src/types/index.ts b/src/types/index.ts index 8080343..443b813 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -8,6 +8,7 @@ export interface Address { } export interface AvailableTimeslots { + id: number; start_time: string; end_time: string; } \ No newline at end of file