Display all bands grouped by genre, create m:n association between Band and Genre in database
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import axios from "axios"
|
||||
import { OrderModel } from "../models/orderModel"
|
||||
import { BasketItemModel } from "../models/basketItemModel"
|
||||
import { calcPrice } from "@/scripts/productScripts"
|
||||
|
||||
const BASE_URL = "http://localhost:3000/orders"
|
||||
|
||||
@@ -17,13 +16,13 @@ export async function addOrder(
|
||||
) {
|
||||
let orderItems = []
|
||||
|
||||
for (let basketItem of basketItems) {
|
||||
orderItems.push({
|
||||
productId: basketItem.product.id,
|
||||
quantity: basketItem.quantity,
|
||||
orderPrice: calcPrice(basketItem.product.price, basketItem.product.discount)
|
||||
})
|
||||
}
|
||||
// for (let basketItem of basketItems) {
|
||||
// orderItems.push({
|
||||
// productId: basketItem.product.id,
|
||||
// quantity: basketItem.quantity,
|
||||
// orderPrice: calcPrice(basketItem.product.price, basketItem.product.discount)
|
||||
// })
|
||||
// }
|
||||
|
||||
return axios.post(BASE_URL, {
|
||||
accountId: accountId,
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
export enum ThemeEnum {
|
||||
DARKRED = "darkRed",
|
||||
LIGHTRED = "lightRed",
|
||||
DARKBLUE = "darkBlue",
|
||||
LIGHTBLUE = "lightBlue",
|
||||
DARKGREEN = "darkGreen",
|
||||
LIGHTGREEN = "lightGreen"
|
||||
DARKBLUE = "dark",
|
||||
LIGHTBLUE = "light",
|
||||
|
||||
}
|
||||
@@ -10,7 +10,9 @@ export class BandModel {
|
||||
descriptionDe: string
|
||||
images: Array<string>
|
||||
logo: string
|
||||
genre: GenreModel
|
||||
ratings: Array<RatingModel>
|
||||
members: Array<MemberModel>
|
||||
genre: {
|
||||
name: string
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,19 @@
|
||||
import { MemberModel } from "./memberModel"
|
||||
import { RatingModel } from "./ratingModel"
|
||||
|
||||
export class GenreModel {
|
||||
id: number
|
||||
name: string
|
||||
bands: Array<
|
||||
{
|
||||
name: string
|
||||
foundingYear: number
|
||||
descriptionEn: string
|
||||
descriptionDe: string
|
||||
images: Array<string>
|
||||
logo: string
|
||||
ratings: Array<RatingModel>
|
||||
members: Array<MemberModel>
|
||||
}
|
||||
>
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import { useFeedbackStore } from "./feedbackStore";
|
||||
import { loginAccount, registerAccount, updateAccount } from "../api/accountApi";
|
||||
import { getUserOrders } from "../api/orderApi";
|
||||
import { BannerStateEnum } from "../enums/bannerStateEnum";
|
||||
import { calcPrice } from "@/scripts/productScripts";
|
||||
import { AddressModel } from "../models/addressModel";
|
||||
import { PaymentModel } from "../models/paymentModel";
|
||||
|
||||
@@ -86,9 +85,9 @@ export const useAccountStore = defineStore("accountStore", {
|
||||
let totalPrice = 0
|
||||
let order: OrderModel = this.orders.find((order: OrderModel) => order.id == orderId)
|
||||
|
||||
for (let item of order.orderItems) {
|
||||
totalPrice += calcPrice(item.orderPrice, 0, item.quantity)
|
||||
}
|
||||
// for (let item of order.orderItems) {
|
||||
// totalPrice += calcPrice(item.orderPrice, 0, item.quantity)
|
||||
// }
|
||||
|
||||
return Math.round(totalPrice * 100) / 100
|
||||
},
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { useLocalStorage } from "@vueuse/core";
|
||||
import { calcPrice } from "@/scripts/productScripts";
|
||||
import { BasketItemModel } from "../models/basketItemModel";
|
||||
import { useFeedbackStore } from "./feedbackStore";
|
||||
import { BannerStateEnum } from "../enums/bannerStateEnum";
|
||||
@@ -26,9 +25,9 @@ export const useBasketStore = defineStore('basketStore', {
|
||||
getTotalPrice() {
|
||||
let result = 0
|
||||
|
||||
for (let item of this.itemsInBasket) {
|
||||
result += calcPrice(item.product.price, item.product.discount, item.quantity)
|
||||
}
|
||||
// for (let item of this.itemsInBasket) {
|
||||
// result += calcPrice(item.product.price, item.product.discount, item.quantity)
|
||||
// }
|
||||
|
||||
return Math.round(result * 100) / 100
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user