26 lines
1.0 KiB
Dart
26 lines
1.0 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
import 'backup_execution.dart';
|
|
import 'backup_target.dart';
|
|
|
|
part 'backup_config.freezed.dart';
|
|
part 'backup_config.g.dart';
|
|
|
|
/// Mirrors `models.BackupConfig`. Used both at node level (`GET /node/backup`)
|
|
/// and per-service (`Service.backup`). `nextRun`/`lastRun` here are
|
|
/// aggregates (earliest/latest) across `targets` — each target now tracks
|
|
/// its own `schedule`/`lastRun`/`nextRun` too. There's no `frequency` field
|
|
/// on the Go side anymore; scheduling moved to a per-target cron `schedule`.
|
|
@freezed
|
|
sealed class BackupConfig with _$BackupConfig {
|
|
const factory BackupConfig({
|
|
@JsonKey(name: 'source_path') String? sourcePath,
|
|
@Default(<BackupTarget>[]) List<BackupTarget> targets,
|
|
@JsonKey(name: 'next_run') DateTime? nextRun,
|
|
@JsonKey(name: 'last_run') DateTime? lastRun,
|
|
@Default(<BackupExecution>[]) List<BackupExecution> history,
|
|
}) = _BackupConfig;
|
|
|
|
factory BackupConfig.fromJson(Map<String, dynamic> json) => _$BackupConfigFromJson(json);
|
|
}
|