Atomize model classes
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user