Files
pipelines/app/test/features/schedules/domain/editor/draft_fixtures.dart
T
alan 914866f640 feat(app): add pure schedule editor draft and validation
Build a save_schedule record from server schedule records with the web
editor's field messages. The draft preserves unknown record, input, rule
and run-option fields, keeps the exact revision, writes the operator's
workspace and sends no payload while any field is invalid.
2026-10-21 20:08:02 +01:00

43 lines
1003 B
Dart

import 'dart:convert';
import 'package:pipelines_app/core/api_gateway.dart';
JsonMap deepCopy(JsonMap value) => jsonDecode(jsonEncode(value)) as JsonMap;
/// A server record with every editable field plus unknown record, input, rule
/// and run-option keys this slice must preserve.
JsonMap completeRecord() => {
'id': 9,
'revision': 13,
'name': 'Saved topic',
'pipeline_id': 4,
'version': 2,
'enabled': true,
'input': {
'prompt': 'Topic',
'count': 4,
'flag': false,
'nested': {
'list': [null, 2],
},
},
'workspace': '/srv/research',
'rule': {
'times': ['09:00', '17:30'],
'days': ['fri', 'mon'],
'timezone': '',
'future': 'keep',
},
'model': 'provider/model',
'stage_models': {'research': 'provider/other'},
'write_paths': ['src/file.go'],
'allow_tools': true,
'title': 'Saved title',
'output_format': 'json',
'notify_mode': 'off',
'next_due': '2026-10-22T09:00:00Z',
'server_extra': {
'keep': [1, true],
},
};