33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { apiClient } from '@/shared/api/client'
|
|
import type { ApiResponse } from '@/shared/types/types'
|
|
|
|
export interface BackupSchedule {
|
|
enabled: boolean
|
|
full_hour: number
|
|
full_minute: number
|
|
binlog_interval_minutes: number
|
|
}
|
|
|
|
export interface BackupStatus {
|
|
generated_at: string
|
|
health: 'healthy' | 'warning'
|
|
last_full: { local_complete: string; remote_complete: string }
|
|
last_binlog: { file: string; remote_dir: string }
|
|
last_job: { type: string; status: string; at: string; message: string }
|
|
}
|
|
|
|
export async function fetchBackupStatus() {
|
|
const { data } = await apiClient.get<ApiResponse<BackupStatus>>('/admin/backups/status')
|
|
return data.data
|
|
}
|
|
|
|
export async function fetchBackupSchedule() {
|
|
const { data } = await apiClient.get<ApiResponse<BackupSchedule>>('/admin/backups/schedule')
|
|
return data.data
|
|
}
|
|
|
|
export async function updateBackupSchedule(payload: BackupSchedule) {
|
|
const { data } = await apiClient.put<ApiResponse<BackupSchedule>>('/admin/backups/schedule', payload)
|
|
return data.data
|
|
}
|