implement demo data
This commit is contained in:
parent
851e756dc3
commit
632081db87
4 changed files with 8 additions and 6 deletions
|
@ -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();
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
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);
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
@ -14,6 +17,7 @@ export const resolveAddressHandler = (req: Request, res: Response) => {
|
||||||
export const timeslotsHandler = (req: Request, res: Response) => {
|
export const timeslotsHandler = (req: Request, res: Response) => {
|
||||||
// TODO: Implement timeslots functionality
|
// TODO: Implement timeslots functionality
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deliveriesHandler = (req: Request, res: Response) => {
|
export const deliveriesHandler = (req: Request, res: Response) => {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
|
@ -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);
|
||||||
}
|
}
|
Loading…
Reference in a new issue