Merge branch 'dev' of ssh://git.congegni.net:4022/Congegni/sintonia_webapp into dev

This commit is contained in:
Marco Cavalli 2025-04-03 15:01:11 +02:00
commit 36d3deab44
26 changed files with 521 additions and 243 deletions

View file

@ -1,33 +1,31 @@
enum ShowRepeatEnum {
Weekly = 0,
Biweekly = 1,
Triweekly = 4,
FourWeeks = 5,
Monthly = 2,
// TODO i18n strings
export enum ShowRepeatEnum {
weekly = 'Weekly',
biweekly = 'Biweekly',
triweekly = 'Triweekly',
fourWeeks = 'Four weeks',
monthly = 'Monthly',
noRepeat = 'No repeat',
}
export interface ShowRepetitionType {
type: ShowRepeatEnum;
repeatName: string
}
export const showRepetitionData: ShowRepetitionType[] = [
{ type: ShowRepeatEnum.Weekly, repeatName: "Weekly" },
{ type: ShowRepeatEnum.Biweekly, repeatName: "Biweekly" },
{ type: ShowRepeatEnum.Triweekly, repeatName: "Triweekly" },
{ type: ShowRepeatEnum.FourWeeks, repeatName: "Four Weeks" },
{ type: ShowRepeatEnum.Monthly, repeatName: "Monthly" },
];
export const showRepetitionData: ShowRepetitionType[] = Object.entries(ShowRepeatEnum).map(([key, value]) => ({
type: key as ShowRepeatEnum,
repeatName: value,
}));
enum WeekDaysEnum {
Monday = 0,
Tuesday = 1,
Wednesday = 2,
Thursday = 3,
Friday = 4,
Saturday = 5,
Sunday = 6,
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6,
Sunday = 0,
}
export interface WeekDays {

View file

@ -1,6 +1,6 @@
import type {ShowInstance} from "@models/show/showInstance.ts";
import type {ShowDays} from "@models/show/showDays";
import type {ShowDjs} from "@models/show/showDjs";
import type {ShowDJs} from "@models/show/showDJs.ts";
import axios, {type AxiosResponse} from "axios";
import {cleanOptions} from "@/helpers/AxiosHelper.ts";
@ -18,13 +18,13 @@ export interface Show {
liveStreamPass?: string;
imagePath?: string | File;
hasAutoplaylist: boolean;
autoplaylist_id?: number;
autoplaylistId?: number;
autoplaylistRepeat: boolean;
// Relationships
block?: any;
showDays?: ShowDays;
showDjs?: ShowDjs[];
showDjs?: ShowDJs[];
showInstances?: ShowInstance[];
playlist?: any;
}
@ -32,7 +32,7 @@ export interface Show {
export const baseShow = (): Show => {
return {
id: null,
name: '',
name: 'Esempio',
url: '',
genre: '',
description: '',
@ -42,7 +42,7 @@ export const baseShow = (): Show => {
liveStreamPass: '',
imagePath: '',
hasAutoplaylist: false,
autoplaylist_id: 0,
autoplaylistId: null,
autoplaylistRepeat: false,
showDjs: null,
showDays: null,

View file

@ -1,6 +1,6 @@
import { VTextField } from "vuetify/components";
export interface ShowDjs {
export interface ShowDJs {
id?: number;
subjsId: number;
showId: number;
@ -11,7 +11,7 @@ export interface User {
login: string;
}
export function showDjsForm(item: ShowDjs) {
export function showDjsForm(item: ShowDJs) {
const visibleFields = {
subjsId: 'Presentatore',
showId: 'Programma'
@ -22,7 +22,7 @@ export function showDjsForm(item: ShowDjs) {
Object.keys(visibleFields).forEach((key) => {
fields[key] = {
label: visibleFields[key],
value: item[key as keyof ShowDjs],
value: item[key as keyof ShowDJs],
component: VTextField,
disabled: false
};

View file

@ -1,6 +1,8 @@
import axios, {type AxiosResponse} from "axios";
import {cleanOptions} from "@/helpers/AxiosHelper.ts";
import {cleanOptions, snakeToCamel} from "@/helpers/AxiosHelper.ts";
import type {ShowRepetitionType} from "@models/show/ShowRepetition.ts";
//TODO RepeatType should use the interface ShowRepetitionType
export interface ShowDays {
id?: number;
firstShow: Date;
@ -9,7 +11,7 @@ export interface ShowDays {
timezone: string;
duration: string;
day: number[];
repeatType: number;
repeatType: string;
nextPopDate?: string;
showId?: number;
record?: number;
@ -22,8 +24,8 @@ export const baseShowDays = ():ShowDays => {
startTime: '08:00',
timezone: '',
duration: '01:00',
day: [0],
repeatType: 0,
day: [],
repeatType: 'noRepeat',
nextPopDate: '',
showId: 0,
record: 0
@ -31,14 +33,14 @@ export const baseShowDays = ():ShowDays => {
}
export const getShowDays = async (options: {
showId?: number | null;
show_id?: number | null;
flattenShowDays?: boolean;
}): Promise<ShowDays> => {
const filteredParams = cleanOptions(options);
return await axios.get(`/showDays`, {params: filteredParams})
.then((response: AxiosResponse) => {
return response.data
return snakeToCamel(response.data);
}).catch((error: Error) => {
console.log("Error: " + error);
})