adding more Info to the code

This commit is contained in:
Kfir Dayan 2023-04-26 20:45:05 +03:00
parent 418b64ad9a
commit b92a569e04
2 changed files with 9 additions and 1 deletions

View file

@ -24,6 +24,7 @@ export const resolveAddressHandler = (req: Request, res: Response) => {
const address: Promise<Address> = resolveAddress(req.body.searchTerm);
address.then((result) => {
res.status(200).json(result);
return;
})
};
@ -42,6 +43,7 @@ export const timeslotsHandler = async (req: Request, res: Response) => {
}
});
res.status(200).json(availableTimeSlotsResult);
return;
};
export const deliveriesHandler = (req: Request, res: Response) => {
@ -101,6 +103,7 @@ export const deliveriesHandler = (req: Request, res: Response) => {
console.log("slotsInUse", slotsInUse)
res.status(200).json(delivery);
return;
};
@ -128,7 +131,9 @@ export const cancelDeliveryHandler = (req: Request, res: Response) => {
if (index > -1) {
slot.splice(index, 1);
}
res.status(200).json(delivery);
return;
};
export const dailyDeliveriesHandler = (req: Request, res: Response) => {
@ -142,8 +147,8 @@ export const dailyDeliveriesHandler = (req: Request, res: Response) => {
});
}
res.status(200).json(todaysOrders);
return;
};
export const weeklyDeliveriesHandler = (req: Request, res: Response) => {
@ -160,6 +165,7 @@ export const weeklyDeliveriesHandler = (req: Request, res: Response) => {
}
}
res.status(200).json(weeklyOrders);
return;
};

View file

@ -1,5 +1,7 @@
// INFO: this is a simple in-memory cache, for demo purposes only. this app will not scale!
// INFO: SQL database is required for continuing this application!
// INFO: Used Map instead of Object for better performance.
// INFO: Making foundation for PostgresSQL database. migration files are in src/migrations
import app from './app';