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 express from 'express';
import routes from './routes'; import routes from './routes';
import { getAvailableTimeSlots } from './services/timeslotsService';
import { getHolidays } from './services/holidaysService';
const app = express(); const app = express();

View file

@ -1,18 +1,22 @@
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { resolveAddress } from './geocoding'; import { resolveAddress } from './geocoding';
import { Address } from './types'; import { Address } from './types';
// DOME
import { getAvailableTimeSlots } from './services/timeslotsService';
import { getHolidays } from './services/holidaysService';
export const resolveAddressHandler = (req: Request, res: Response) => { export const resolveAddressHandler = (req: Request, res: Response) => {
console.log("resolveAddressHandler called"); console.info("resolveAddressHandler called");
const address: Promise<Address> = resolveAddress(req.body.searchTerm); const address: Promise<Address> = resolveAddress(req.body.searchTerm);
address.then((result) => { address.then((result) => {
console.log("resolveAddressHandler result: ", result); console.info("resolveAddressHandler result: ", result);
res.status(200).json(result); res.status(200).json(result);
}) })
}; };
export const timeslotsHandler = (req: Request, res: Response) => { export const timeslotsHandler = (req: Request, res: Response) => {
// TODO: Implement timeslots functionality // 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'; import holidays from '../data/holidays.json';
export function getHolidays() { export function getHolidays() {
// for demo resolving the promise immediately with mock data
return Promise.resolve(holidays); 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'; import timeSlots from '../data/timeslots.json';
export function getAvailableTimeSlots() { export function getAvailableTimeSlots() {
// for demo resolving the promise immediately with mock data
return Promise.resolve(timeSlots); return Promise.resolve(timeSlots);
} }