Initial commit

Made-with: Cursor
This commit is contained in:
Dusan Vojacek
2026-03-20 13:27:37 +01:00
commit 8b4af663d8
77 changed files with 13337 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
import axios, { type AxiosInstance } from 'axios'
import type { CurrentPlanResponse, RunPlanResponse } from '../types/plan'
const client: AxiosInstance = axios.create({
baseURL: '/api/v1',
headers: { Accept: 'application/json' },
timeout: 30_000,
})
/** Příklad: health / readiness až budou v FastAPI exponované. */
export async function getBackendHealth(): Promise<unknown> {
const { data } = await client.get('/health')
return data
}
export type SetSiteModePayload = {
mode: string
notes: string | null
valid_until: string | null
}
export type SetSiteModeResponse = {
success: boolean
mode: string
activated_at: string
}
export async function postSiteMode(
siteId: number,
payload: SetSiteModePayload,
): Promise<SetSiteModeResponse> {
const { data } = await client.post<SetSiteModeResponse>(`/sites/${siteId}/mode`, payload)
return data
}
export async function getCurrentPlan(siteId: number): Promise<CurrentPlanResponse> {
const { data } = await client.get<CurrentPlanResponse>(`/sites/${siteId}/plan/current`, {
timeout: 60_000,
})
return data
}
export async function postRunPlan(
siteId: number,
planType: 'daily' | 'rolling',
): Promise<RunPlanResponse> {
const { data } = await client.post<RunPlanResponse>(
`/sites/${siteId}/plan/run`,
null,
{ params: { type: planType }, timeout: 120_000 },
)
return data
}
export { client as backendClient }