implement demo data

This commit is contained in:
Kfir Dayan 2023-04-25 02:00:39 +03:00
parent 851e756dc3
commit 632081db87
4 changed files with 8 additions and 6 deletions

View file

@ -1,7 +1,5 @@
import express from 'express';
import routes from './routes';
import { getAvailableTimeSlots } from './services/timeslotsService';
import { getHolidays } from './services/holidaysService';
const app = express();

View file

@ -1,18 +1,22 @@
import { Request, Response } from 'express';
import { resolveAddress } from './geocoding';
import { Address } from './types';
// DOME
import { getAvailableTimeSlots } from './services/timeslotsService';
import { getHolidays } from './services/holidaysService';
export const resolveAddressHandler = (req: Request, res: Response) => {
console.log("resolveAddressHandler called");
console.info("resolveAddressHandler called");
const address: Promise<Address> = resolveAddress(req.body.searchTerm);
address.then((result) => {
console.log("resolveAddressHandler result: ", result);
console.info("resolveAddressHandler result: ", result);
res.status(200).json(result);
})
};
export const timeslotsHandler = (req: Request, res: Response) => {
// TODO: Implement timeslots functionality
};

View file

@ -1,6 +1,6 @@
// for demo resolving the promise immediately with mock data
import holidays from '../data/holidays.json';
export function getHolidays() {
// for demo resolving the promise immediately with mock data
return Promise.resolve(holidays);
}

View file

@ -1,6 +1,6 @@
// for demo resolving the promise immediately with mock data
import timeSlots from '../data/timeslots.json';
export function getAvailableTimeSlots() {
// for demo resolving the promise immediately with mock data
return Promise.resolve(timeSlots);
}