Atomize model classes

This commit is contained in:
2024-10-11 17:42:21 +02:00
parent cfb8fb9d7d
commit 0ec11aacf7
59 changed files with 432 additions and 356 deletions

View File

@@ -1,5 +1,5 @@
import axios from "axios"
import { AccountModel } from "../models/accountModel"
import { AccountModel } from "../models/user/accountModel"
const BASE_URL = "http://localhost:3000/accounts"

View File

@@ -2,6 +2,14 @@ import axios from "axios"
const BASE_URL = "http://localhost:3000/events"
/**
* Request all events in the database
*
* @param city Filter by name of city where the concert is
* @param genre Filter by genre of the band
*
* @returns All events which fulfill the params
*/
export async function fetchEvents(city: string = "", genre: string = "") {
let url = BASE_URL + "?"
url += (city.length > 0) ? "city=" + city + "&" : ""
@@ -10,7 +18,14 @@ export async function fetchEvents(city: string = "", genre: string = "") {
return await axios.get(url)
}
export async function getTopEvents(nrOfEvents) {
/**
* Returns events with the most concerts
*
* @param nrOfEvents Limit number of returned objects
*
* @returns Limited number of objects with the most concerts in it
*/
export async function getTopEvents(nrOfEvents: number) {
let url = BASE_URL + "?sort=desc&count=" + nrOfEvents
return await axios.get(url)

View File

@@ -1,6 +1,5 @@
import axios from "axios"
import { OrderModel } from "../models/orderModel"
import { BasketItemModel } from "../models/basketItemModel"
import { BasketItemModel } from "../models/ordering/basketItemModel"
const BASE_URL = "http://localhost:3000/orders"