Creating admin pages, new brand API endpoint
This commit is contained in:
@@ -122,7 +122,7 @@
|
||||
"iban": "DE41500105172184936679"
|
||||
}
|
||||
],
|
||||
"accountRoleId": 1
|
||||
"accountRoleId": 2
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
"thinkpad-t14s-6.avif",
|
||||
"thinkpad-t14s-7.avif"
|
||||
],
|
||||
"inStock": 5
|
||||
"inStock": 5,
|
||||
"offered": true
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
@@ -52,7 +53,8 @@
|
||||
"puma-t-shirt-men-4.jpg",
|
||||
"puma-t-shirt-men-5.jpg"
|
||||
],
|
||||
"inStock": 30
|
||||
"inStock": 30,
|
||||
"offered": true
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -78,7 +80,8 @@
|
||||
"puma-t-shirt-woman-5.jpg",
|
||||
"puma-t-shirt-woman-6.jpg"
|
||||
],
|
||||
"inStock": 30
|
||||
"inStock": 30,
|
||||
"offered": true
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
@@ -108,7 +111,8 @@
|
||||
"1984-2.webp",
|
||||
"1984-3.webp"
|
||||
],
|
||||
"inStock": 30
|
||||
"inStock": 30,
|
||||
"offered": true
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
@@ -135,7 +139,8 @@
|
||||
"brave-new-world-1.jpg",
|
||||
"brave-new-world-2.jpg"
|
||||
],
|
||||
"inStock": 30
|
||||
"inStock": 30,
|
||||
"offered": true
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
@@ -160,7 +165,8 @@
|
||||
"dell-xps-desktop-5.jpg",
|
||||
"dell-xps-desktop-6.jpg"
|
||||
],
|
||||
"inStock": 10
|
||||
"inStock": 10,
|
||||
"offered": true
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
@@ -198,7 +204,8 @@
|
||||
"fender-player-ii-jazz-bass-rw-3ts-4.jpg",
|
||||
"fender-player-ii-jazz-bass-rw-3ts-5.jpg"
|
||||
],
|
||||
"inStock": 15
|
||||
"inStock": 15,
|
||||
"offered": true
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
@@ -239,7 +246,8 @@
|
||||
"esp-lts-iron-cross-sw-5.jpg",
|
||||
"esp-lts-iron-cross-sw-6.jpg"
|
||||
],
|
||||
"inStock": 0
|
||||
"inStock": 0,
|
||||
"offered": true
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
@@ -273,7 +281,8 @@
|
||||
"pearl-decade-maple-standard-black-5.jpg",
|
||||
"pearl-decade-maple-standard-black-6.jpg"
|
||||
],
|
||||
"inStock": 4
|
||||
"inStock": 4,
|
||||
"offered": true
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
@@ -299,7 +308,8 @@
|
||||
"macbook-air-4.avif",
|
||||
"macbook-air-5.avif"
|
||||
],
|
||||
"inStock": 18
|
||||
"inStock": 18,
|
||||
"offered": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -31,6 +31,9 @@ export class Product extends Model {
|
||||
@Column
|
||||
inStock: number
|
||||
|
||||
@Column
|
||||
offered: boolean
|
||||
|
||||
@Column({
|
||||
type: DataType.STRING,
|
||||
get(): Array<string> {
|
||||
|
||||
12
software/backend/routes/brand.routes.ts
Normal file
12
software/backend/routes/brand.routes.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Brand } from "../models/brand.model"
|
||||
import { Request, Router, Response } from "express"
|
||||
|
||||
export const brand = Router()
|
||||
|
||||
// Get all brands
|
||||
brand.get("/", (req: Request, res: Response) => {
|
||||
Brand.findAll()
|
||||
.then(brands => {
|
||||
res.status(200).json(brands)
|
||||
})
|
||||
})
|
||||
@@ -7,6 +7,7 @@ import { category } from './routes/category.routes'
|
||||
import { product } from './routes/product.routes'
|
||||
import { order } from './routes/order.routes'
|
||||
import { account } from './routes/account.routes'
|
||||
import { brand } from './routes/brand.routes'
|
||||
|
||||
const app = express()
|
||||
const port = 3000
|
||||
@@ -35,6 +36,7 @@ app.use("/categories", category)
|
||||
app.use("/products", product)
|
||||
app.use("/orders", order)
|
||||
app.use("/accounts", account)
|
||||
app.use("/brands", brand)
|
||||
|
||||
|
||||
// Start server
|
||||
|
||||
Reference in New Issue
Block a user