import type {ShowInstance} from "@models/show/showInstance.ts"; import type {ShowDays} from "@models/show/showDays"; import type {ShowDJs} from "@models/show/showDJs.ts"; import axios, {type AxiosResponse} from "axios"; import {cleanOptions} from "@/helpers/AxiosHelper.ts"; export interface Show { id?: number; name: string; url: string; genre: string; description: string; color?: string; backgroundColor: string; liveStreamUsingAirtimeAuth?: boolean; liveStreamUsingCustomAuth?: boolean; liveStreamUser?: string; liveStreamPass?: string; imagePath?: string | File; hasAutoplaylist: boolean; autoplaylistId?: number; autoplaylistRepeat: boolean; // Relationships block?: any; showDays?: ShowDays; showDjs?: ShowDJs[]; showInstances?: ShowInstance[]; playlist?: any; } export const baseShow = (): Show => { return { id: null, name: 'Esempio', url: '', genre: '', description: '', backgroundColor: '', liveStreamUsingAirtimeAuth: false, liveStreamUser: '', liveStreamPass: '', imagePath: '', hasAutoplaylist: false, autoplaylistId: null, autoplaylistRepeat: false, showDjs: null, showDays: null, } } export const showTableHeader = [ {title: 'Nome', value: 'name'}, {title: 'dj', value: 'dj'}, {title: 'Durata', value: 'length'}, {title: 'Schedulata', value: 'scheduled'}, {title: 'Azioni', value: 'actions'} ] export const getShow = async (options: { id?: number | null; scheduled?: number | null; withDjs?: boolean | null; isScheduled?: boolean | null; page?: Number | null; per_page?: Number | null; all?: string | null; }): Promise => { const filteredParams = cleanOptions(options); return await axios.get(`/show`, {params: filteredParams}) .then((response: AxiosResponse) => { return response.data }).catch((error: Error) => { console.log("Error: " + error); }) } export const deleteShow = async (showIds: Number[]) => { return axios.delete(`show`, {data: {'showIds': showIds}}) }