70 lines
No EOL
1.9 KiB
TypeScript
70 lines
No EOL
1.9 KiB
TypeScript
import {VDatePicker, VSelect, VTextField} from "vuetify/components";
|
|
import type {Show} from "@models/show/show";
|
|
import axios, {type AxiosResponse} from "axios";
|
|
import {cleanOptions} from "@/helpers/AxiosHelper.ts";
|
|
|
|
export interface ShowInstance {
|
|
id?: number;
|
|
starts: string;
|
|
ends: string;
|
|
instance_description: '',
|
|
showId: number;
|
|
record: number;
|
|
rebroadcast: number;
|
|
timeFilled: string;
|
|
created?: string;
|
|
modifiedInstance: boolean;
|
|
autoplaylistBuilt: boolean;
|
|
|
|
// Relationships
|
|
Playlist?: any;
|
|
show?: Show;
|
|
}
|
|
|
|
export const baseShowInstance = (): ShowInstance => {
|
|
return {
|
|
id: null,
|
|
starts: '',
|
|
ends: '',
|
|
instance_description: '',
|
|
showId: 0,
|
|
record: 0,
|
|
rebroadcast: 0,
|
|
timeFilled: '00:00:00',
|
|
created: null,
|
|
modifiedInstance: false,
|
|
autoplaylistBuilt: false,
|
|
};
|
|
};
|
|
|
|
export async function getShowInstances(options: {
|
|
showId?: number | null;
|
|
starts?: string | null;
|
|
ends?: string | null;
|
|
withShow?: boolean | null;
|
|
}): Promise<ShowInstance[]> {
|
|
const filteredParams = cleanOptions(options);
|
|
|
|
return await axios.get(`/showInstances`, { params: filteredParams }).then((response: AxiosResponse) => {
|
|
return response.data
|
|
}).catch((error: Error) => {
|
|
console.log("Error: " + error);
|
|
});
|
|
}
|
|
|
|
export const deleteShowInstance = async (showInstancesIds: Number[]) => {
|
|
return axios.delete(`showInstances`, {data: {'showInstancesIds': showInstancesIds}})
|
|
}
|
|
|
|
export async function getShowInstance(options: {
|
|
showInstanceId?: number | null;
|
|
withShow?: boolean | null;
|
|
}): Promise<ShowInstance[]> {
|
|
const filteredParams = cleanOptions(options);
|
|
|
|
return await axios.get(`/showInstances`, { params: filteredParams }).then((response: AxiosResponse) => {
|
|
return response.data
|
|
}).catch((error: Error) => {
|
|
console.log("Error: " + error);
|
|
});
|
|
} |