Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link frontend + backend #46

Merged
merged 30 commits into from
Mar 19, 2022
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ebe48ac
sample code
ZhechunZhou Feb 23, 2022
1590832
sample code
ZhechunZhou Feb 23, 2022
b301ea6
Add create customer route
bluo999 Feb 27, 2022
3f742c8
Merge branch 'front-back-connection' of https://github.com/CMU-17-356…
ZhechunZhou Feb 27, 2022
8879b23
Implement submitOrder()
Feb 27, 2022
130fcec
nav and menu
ZhechunZhou Feb 27, 2022
52c5601
Adding function: Navigating to Employee view
Feb 27, 2022
50dead7
Clean up backend routes
bluo999 Feb 27, 2022
690d407
Update menu
bluo999 Feb 27, 2022
40089b0
Update mongodb db url
bluo999 Feb 27, 2022
0ae39e8
fix: duplicated keys
Feb 27, 2022
85fa279
Merge branch 'front-back-connection' of github.com:CMU-17-356/dronuts…
Feb 27, 2022
0a79858
fix: Adding success response to postOrder
Feb 27, 2022
a9fd3bd
header
ZhechunZhou Feb 27, 2022
1728877
Use db data for employee page
bluo999 Feb 27, 2022
35cb1f9
dynamic card
ZhechunZhou Feb 27, 2022
136ca31
Merge branch 'front-back-connection' of https://github.com/CMU-17-356…
ZhechunZhou Feb 27, 2022
d1461ec
Update customer routes: order and confirm
bluo999 Feb 28, 2022
a99807a
Dynamic employee order view with dismissing
bluo999 Feb 28, 2022
d7897f9
Update confirmation page to show order details
bluo999 Mar 1, 2022
b650fda
Adding shopping cart functionality
adamwang89 Mar 1, 2022
cc7dc05
Fixed linting issues
adamwang89 Mar 1, 2022
cfd16a7
Merge pull request #47 from CMU-17-356/Cart_Functionality
adamwang89 Mar 1, 2022
7f0fba0
order submission
ZhechunZhou Mar 1, 2022
dcf106c
donut card update
ZhechunZhou Mar 1, 2022
c824491
Update order route to return most recent order
bluo999 Mar 1, 2022
0c599c1
Update backend sorting
bluo999 Mar 1, 2022
0569dc4
Only show unconfirmed orders
bluo999 Mar 1, 2022
406dcd5
Lint
bluo999 Mar 1, 2022
1e668ed
DonutCard employee vs menu
bluo999 Mar 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add create customer route
bluo999 committed Feb 27, 2022
commit b301ea6e9b3c7839b4bec5c5172e753fa8aa34cf
18 changes: 17 additions & 1 deletion backend/src/routes/customer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
import {Request, Response, Router} from "express";

import {CustomerModel} from "../models/customer";
import {CustomerInterface, CustomerModel} from "../models/customer";
import {OrderInterface, OrderModel,} from "../models/order";

const customerRouter = Router();

customerRouter.post('/create', [], async function (req: Request, res: Response) {
if (!req.body) {
res.sendStatus(500);
return;
}
try {
const customerData: CustomerInterface = new CustomerModel(req.body);
const customerStore = new CustomerModel(customerData);
const custRes = await customerStore.save();
res.send(custRes);
} catch (err) {
console.log(err);
res.status(500).send(err);
}
});

customerRouter.get('/profile', async function (req, res) {
const custId = req.query.custId;
if (!custId) {