Display concerts with card views on "All concerts" page, adding image property for tours

This commit is contained in:
2024-09-28 21:18:25 +02:00
parent 8d0b141217
commit 0616409f14
49 changed files with 454 additions and 219 deletions

View File

@@ -239,6 +239,60 @@
"bandId": 4
}
]
},
{
"id": 5,
"name": "Billy Talent",
"foundingYear": 1993,
"descriptionEn": "Billy Talent is a Canadian rock band from Mississauga, Ontario. They formed in 1993 with lead vocalist Benjamin Kowalewicz, guitarist Ian D'Sa, bassist Jonathan Gallant, and drummer Aaron Solowoniuk. There have been no lineup changes, although Solowoniuk has been on hiatus from the band since 2016 due to a relapse of multiple sclerosis. In the three decades since their inception, Billy Talent has sold well over a million physical albums in Canada alone and nearly 3 million albums internationally. During their most successful period, they were ranked as one of the top 10 best-selling native bands in Canada.",
"descriptionDe": "Billy Talent ist eine kanadische Rockband aus Mississauga, Ontario. Die Band spielte anfangs Punk, ordnet sich auf den späteren Alben jedoch eher im Alternative Rock ein. ",
"images": [ "billy-talent-1.jpg" ],
"logo": "billy-talent-logo.png",
"genreId": [ 2, 11, 12, 13 ],
"members": [
{
"name": "Benjamin Kowalewicz",
"bandId": 5,
"image": "benjamin-kowalewicz.jpg"
},
{
"name": "Ian D'Sa ",
"bandId": 5,
"image": "ian-d-sa.jpg"
},
{
"name": "Jonathan Gallant",
"bandId": 5,
"image": "jonathan-gallant.jpg"
},
{
"name": "Jordan Hastings",
"bandId": 5,
"image": "jordan-hastings.jpg"
},
{
"name": "Josh Freese",
"bandId": 5,
"image": "josh-freese.jpg"
}
],
"ratings": [
{
"accountId": 0,
"rating": 5,
"bandId": 5
},
{
"accountId": 1,
"rating": 3,
"bandId": 5
},
{
"accountId": 2,
"rating": 4,
"bandId": 5
}
]
}
]
}

View File

@@ -1,39 +0,0 @@
{
"data": [
{
"id": 0,
"icon": "",
"name": "All"
},
{
"id": 1,
"icon": "mdi-chip",
"name": "Electronic"
},
{
"id": 2,
"icon": "mdi-soccer",
"name": "Sports"
},
{
"id": 3,
"icon": "mdi-tshirt-crew",
"name": "Clothes"
},
{
"id": 4,
"icon": "mdi-bookshelf",
"name": "Books"
},
{
"id": 5,
"icon": "mdi-guitar-electric",
"name": "Instruments"
},
{
"id": 6,
"icon": "mdi-teddy-bear",
"name": "Toys"
}
]
}

View File

@@ -43,6 +43,18 @@
{
"id": 10,
"name": "Post-Grunge"
},
{
"id": 11,
"name": "Punk-Rock"
},
{
"id": 12,
"name": "Post-Hardcore"
},
{
"id": 13,
"name": "Pop-Punk"
}
]
}

View File

@@ -2,40 +2,74 @@
"data": [
{
"id": 0,
"name": "Unlimited Love Tour",
"name": "Unlimited Love",
"bandId": 0,
"offered": true,
"shows": [
"image": "unlimited-love-tour.jpg",
"concerts": [
{
"id": 0,
"date": "2024-12-03",
"date": "2024-10-18",
"price": 92,
"inStock": 230,
"inStock": 930,
"locationId": 0,
"tourId": 0
},
{
"id": 1,
"date": "2024-10-23",
"price": 119.90,
"inStock": 8736,
"locationId": 4,
"tourId": 0
},
{
"id": 2,
"date": "2024-10-26",
"price": 114.90,
"inStock": 2793,
"locationId": 8,
"tourId": 0
},
{
"id": 3,
"date": "2024-11-02",
"price": 124.90,
"inStock": 3079,
"locationId": 12,
"tourId": 0
}
]
},
{
"id": 1,
"name": "The Bends Tour",
"name": "The Bends",
"bandId": 1,
"offered": true,
"shows": [
"image": "the-bends-tour.jpg",
"concerts": [
{
"id": 1,
"id": 4,
"date": "2024-11-30",
"price": 104,
"inStock": 120,
"locationId": 2,
"price": 108,
"inStock": 1200,
"locationId": 1,
"tourId": 1
},
{
"id": 2,
"id": 5,
"date": "2024-12-01",
"price": 104,
"inStock": 180,
"locationId": 0,
"inStock": 1800,
"locationId": 5,
"tourId": 1
},
{
"id": 6,
"date": "2024-12-07",
"price": 99.90,
"inStock": 2438,
"locationId": 9,
"tourId": 1
}
]
@@ -45,29 +79,55 @@
"name": "European Tour",
"bandId": 2,
"offered": true,
"shows": [
"image": "european-tour-arctic-monkeys.jpg",
"concerts": [
{
"id": 3,
"date": "2024-10-15",
"price": 80,
"inStock": 99,
"id": 7,
"date": "2025-01-21",
"price": 67.90,
"inStock": 994,
"locationId": 3,
"tourId": 2
},
{
"id": 8,
"date": "2024-11-15",
"price": 79.90,
"inStock": 1073,
"locationId": 14,
"tourId": 2
}
]
},
{
"id": 3,
"name": "Moon Music Tour",
"name": "Music of the Spheres",
"bandId": 3,
"offered": true,
"shows": [
"image": "music-of-the-spheres.png",
"concerts": [
{
"id": 4,
"date": "2024-10-15",
"price": 80,
"inStock": 99,
"locationId": 1,
"id": 9,
"date": "2024-12-07",
"price": 124.90,
"inStock": 765,
"locationId": 13,
"tourId": 3
},
{
"id": 10,
"date": "2025-01-17",
"price": 129.90,
"inStock": 989,
"locationId": 9,
"tourId": 3
},
{
"id": 11,
"date": "2025-02-01",
"price": 134.90,
"inStock": 827,
"locationId": 4,
"tourId": 3
}
]
@@ -77,16 +137,42 @@
"name": "But Here We Are Tour",
"bandId": 4,
"offered": true,
"shows": [
"image": "but-here-we-are.jpg",
"concerts": [
{
"id": 5,
"date": "2024-10-15",
"id": 12,
"date": "2024-12-05",
"price": 80,
"inStock": 99,
"locationId": 2,
"tourId": 4
}
]
},
{
"id": 5,
"name": "Crisis of Faith",
"bandId": 5,
"offered": true,
"image": "crisis-of-faith-tour.jpg",
"concerts": [
{
"id": 13,
"date": "2025-01-12",
"price": 81.90,
"inStock": 173,
"locationId": 2,
"tourId": 5
},
{
"id": 14,
"date": "2025-02-01",
"price": 84.90,
"inStock": 192,
"locationId": 6,
"tourId": 5
}
]
}
]
}

View File

@@ -11,7 +11,7 @@ import { AccountRole } from "./models/user/accountRole.model"
import { Genre } from "./models/acts/genre.model"
import { Location } from "./models/acts/location.model"
import { Band } from "./models/acts/band.model"
import { Show } from "./models/acts/show.model"
import { Concert } from "./models/acts/concert.model"
import { Member } from "./models/acts/member.model"
import { Rating } from "./models/acts/rating.model"
import { Tour } from "./models/acts/tour.model"
@@ -31,7 +31,7 @@ export const sequelize = new Sequelize({
storage: "database.sqlite",
models: [
AccountRole, Account, Payment, Address,
City, Location, Genre, Band, BandGenre, Rating, Member, Tour, Show,
City, Location, Genre, Band, BandGenre, Rating, Member, Tour, Concert,
Order, OrderItem
]
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View File

@@ -4,7 +4,7 @@ import { Tour } from "./tour.model";
import { OrderItem } from "../ordering/orderItem.model";
@Table({ timestamps: false })
export class Show extends Model {
export class Concert extends Model {
@Column
date: String

View File

@@ -1,5 +1,5 @@
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
import { Show } from "./show.model";
import { Concert } from "./concert.model";
import { City } from "./city.model";
@Table({ timestamps: false })
@@ -20,8 +20,8 @@ export class Location extends Model {
// Relations
@HasMany(() => Show)
shows: Show[]
@HasMany(() => Concert)
shows: Concert[]
@BelongsTo(() => City)
city: City

View File

@@ -1,6 +1,6 @@
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
import { Band } from "./band.model";
import { Show } from "./show.model";
import { Concert } from "./concert.model";
@Table({ timestamps: false })
export class Tour extends Model {
@@ -13,12 +13,15 @@ export class Tour extends Model {
@Column
offered: Boolean
@Column
image: String
// Relations
@BelongsTo(() => Band)
band: Band
@HasMany(() => Show)
shows: Show[]
@HasMany(() => Concert)
shows: Concert[]
}

View File

@@ -1,5 +1,5 @@
import { Model, BelongsTo, Column, ForeignKey, HasMany, HasOne, Table } from "sequelize-typescript";
import { Show } from "../acts/show.model";
import { Concert } from "../acts/concert.model";
import { Order } from "./order.model";
@Table({ timestamps: false })
@@ -15,7 +15,7 @@ export class OrderItem extends Model {
orderPrice: number
@Column
@ForeignKey(() => Show)
@ForeignKey(() => Concert)
showId: number
@@ -23,6 +23,6 @@ export class OrderItem extends Model {
@BelongsTo(() => Order)
order: Order
@BelongsTo(() => Show)
product: Show
@BelongsTo(() => Concert)
product: Concert
}

View File

@@ -1,13 +1,13 @@
import { Location } from "../models/acts/location.model";
import { Show } from "../models/acts/show.model";
import { Concert } from "../models/acts/concert.model";
import { Request, Response, Router } from "express";
import { Tour } from "../models/acts/tour.model";
import { City } from "../models/acts/city.model";
export const show = Router()
export const concert = Router()
show.get("/:id", (req: Request, res: Response) => {
Show.findByPk(req.params.id, {
concert.get("/:id", (req: Request, res: Response) => {
Concert.findByPk(req.params.id, {
include: [
Tour,
{

View File

@@ -1,6 +1,6 @@
import { Router, Request, Response } from "express";
import { Order } from "../models/ordering/order.model";
import { Show } from "../models/acts/show.model";
import { Concert } from "../models/acts/concert.model";
import { OrderItem } from "../models/ordering/orderItem.model";
import { Payment } from "../models/user/payment.model";
import { Address } from "../models/user/address.model";
@@ -18,7 +18,7 @@ order.get("/:id", (req: Request, res: Response) => {
model: OrderItem,
include: [
{
model: Show,
model: Concert,
include: [ Band, Location ],
attributes: {
exclude: [
@@ -50,7 +50,7 @@ order.post("/", (req: Request, res: Response) => {
productId: orderItem.productId
})
Show.decrement(
Concert.decrement(
"inStock",
{
by: orderItem.quantity,

View File

@@ -1,4 +1,4 @@
import { Show } from "../models/acts/show.model";
import { Concert } from "../models/acts/concert.model";
import { Band } from "../models/acts/band.model";
import { Tour } from "../models/acts/tour.model";
import { Request, Response, Router } from "express";
@@ -19,7 +19,7 @@ tour.get("/", (req: Request, res: Response) => {
}
},
{
model: Show,
model: Concert,
include: [
{
model: Location,

View File

@@ -9,7 +9,7 @@ import { Member } from '../models/acts/member.model'
import { Genre } from '../models/acts/genre.model'
import { Band } from '../models/acts/band.model'
import { Location } from '../models/acts/location.model'
import { Show } from '../models/acts/show.model'
import { Concert } from '../models/acts/concert.model'
import { Tour } from '../models/acts/tour.model'
import { City } from '../models/acts/city.model'
import { BandGenre } from '../models/acts/bandGenre.model'
@@ -36,7 +36,7 @@ export function deleteAllTables() {
Genre.destroy({ truncate: true })
Band.destroy({ truncate: true })
Location.destroy({ truncate: true })
Show.destroy({ truncate: true })
Concert.destroy({ truncate: true })
Address.destroy({ truncate: true })
Payment.destroy({ truncate: true })
@@ -90,8 +90,8 @@ export async function prepopulateDatabase() {
for (let tour of tours.data) {
await Tour.create(tour)
.then(async dataset => {
for (let show of tour.shows) {
await Show.create(show)
for (let concert of tour.concerts) {
await Concert.create(concert)
}
})
}

View File

@@ -5,7 +5,7 @@ import { api } from './routes/api.routes'
import { startDatabase } from './database'
import { order } from './routes/order.routes'
import { account } from './routes/account.routes'
import { show } from './routes/show.routes'
import { concert } from './routes/concert.routes'
import { band } from './routes/band.routes'
import { genre } from './routes/genre.routes'
import { location } from './routes/location.routes'
@@ -35,7 +35,7 @@ app.use('/static', express.static(path.join(__dirname, 'images')))
// Routes
app.use("/api", api)
app.use("/shows", show)
app.use("/shows", concert)
app.use("/bands", band)
app.use("/genres", genre)
app.use("/locations", location)