adding more Info to the code
This commit is contained in:
parent
418b64ad9a
commit
b92a569e04
2 changed files with 9 additions and 1 deletions
|
@ -24,6 +24,7 @@ export const resolveAddressHandler = (req: Request, res: Response) => {
|
||||||
const address: Promise<Address> = resolveAddress(req.body.searchTerm);
|
const address: Promise<Address> = resolveAddress(req.body.searchTerm);
|
||||||
address.then((result) => {
|
address.then((result) => {
|
||||||
res.status(200).json(result);
|
res.status(200).json(result);
|
||||||
|
return;
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,6 +43,7 @@ export const timeslotsHandler = async (req: Request, res: Response) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
res.status(200).json(availableTimeSlotsResult);
|
res.status(200).json(availableTimeSlotsResult);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deliveriesHandler = (req: Request, res: Response) => {
|
export const deliveriesHandler = (req: Request, res: Response) => {
|
||||||
|
@ -101,6 +103,7 @@ export const deliveriesHandler = (req: Request, res: Response) => {
|
||||||
console.log("slotsInUse", slotsInUse)
|
console.log("slotsInUse", slotsInUse)
|
||||||
|
|
||||||
res.status(200).json(delivery);
|
res.status(200).json(delivery);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,7 +131,9 @@ export const cancelDeliveryHandler = (req: Request, res: Response) => {
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
slot.splice(index, 1);
|
slot.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.status(200).json(delivery);
|
res.status(200).json(delivery);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const dailyDeliveriesHandler = (req: Request, res: Response) => {
|
export const dailyDeliveriesHandler = (req: Request, res: Response) => {
|
||||||
|
@ -142,8 +147,8 @@ export const dailyDeliveriesHandler = (req: Request, res: Response) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
res.status(200).json(todaysOrders);
|
res.status(200).json(todaysOrders);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const weeklyDeliveriesHandler = (req: Request, res: Response) => {
|
export const weeklyDeliveriesHandler = (req: Request, res: Response) => {
|
||||||
|
@ -160,6 +165,7 @@ export const weeklyDeliveriesHandler = (req: Request, res: Response) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.status(200).json(weeklyOrders);
|
res.status(200).json(weeklyOrders);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// INFO: this is a simple in-memory cache, for demo purposes only. this app will not scale!
|
// 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: 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';
|
import app from './app';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue