Create OrdersPage, load orders from backend, move NavDrawer items to Component

This commit is contained in:
2024-09-11 20:49:55 +02:00
parent 463b49ba93
commit 0c20ef4366
34 changed files with 361 additions and 178 deletions

View File

@@ -1,12 +1,18 @@
import { Router, Request, Response, NextFunction } from "express";
import { Order } from "../models/order.model";
import { Product } from "../models/product.model";
import { OrderItem } from "../models/orderItem.model";
export const order = Router()
order.get("/", (req: Request, res: Response, next: NextFunction) => {
Order.findAll()
Order.findAll({
where: { accountId: req.query.accountId },
include: [
{ model: OrderItem, include: [ Product ] }
]
})
.then(orders => {
res.json(orders)
res.send(orders)
})
.catch(next)
})