Rewriting database and API to transform to a ticket shop

This commit is contained in:
2024-09-26 11:04:27 +02:00
parent 080610cd7e
commit 787c5a61e5
88 changed files with 1040 additions and 751 deletions

View File

@@ -1,11 +1,11 @@
import { Router, Request, Response } from "express";
import { Order } from "../models/order.model";
import { Product } from "../models/product.model";
import { Show } from "../models/show.model";
import { OrderItem } from "../models/orderItem.model";
import { Brand } from "../models/brand.model";
import { Category } from "../models/category.model";
import { Payment } from "../models/payment.model";
import { Address } from "../models/address.model";
import { Band } from "../models/band.model";
import { Location } from "../models/location.model";
export const order = Router()
@@ -18,8 +18,8 @@ order.get("/:id", (req: Request, res: Response) => {
model: OrderItem,
include: [
{
model: Product,
include: [ Brand, Category ],
model: Show,
include: [ Band, Location ],
attributes: {
exclude: [
"categoryId",
@@ -50,7 +50,7 @@ order.post("/", (req: Request, res: Response) => {
productId: orderItem.productId
})
Product.decrement(
Show.decrement(
"inStock",
{
by: orderItem.quantity,