add statistics

This commit is contained in:
Fran Jurmanović
2025-05-29 00:21:58 +02:00
parent 4f0e93e60d
commit 7b50ac4b32
7 changed files with 681 additions and 35 deletions

View File

@@ -8,7 +8,8 @@ import {
type Configurations,
type EventConfig,
type EventRules,
type ServerSettings
type ServerSettings,
type StateHistory
} from '$models/config';
import type { Server } from '$models/server';
import type { RequestEvent } from '@sveltejs/kit';
@@ -36,6 +37,18 @@ export const getConfigFile = async (
return fetchAPIEvent(event, `/server/${serverId}/config/${file}`);
};
export const getStateHistory = async (
event: RequestEvent,
serverId: string,
startDate: string,
endDate: string
): Promise<Array<StateHistory>> => {
return fetchAPIEvent(
event,
`/server/${serverId}/state-history?start_date=${startDate}&end_date=${endDate}`
);
};
export const getEventFile = async (event: RequestEvent, serverId: string): Promise<EventConfig> => {
return fetchAPIEvent(event, `/server/${serverId}/config/${configFile.event}`);
};