ObjectBox

This commit is contained in:
Sven committed 2025-10-23 11:28:03 +02:00
1 parent e548f62bde
commit f8317be627
60 files changed
+2367 -15049

No files matched your search

+65 -33
View File
@@ -1,52 +1,84 @@
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'tour_task.g.dart';
@embedded
@JsonSerializable()
class TourTask {
@JsonKey(name: 's_id')
late int sId;
late int type;
late String topic;
@JsonKey(name: 'opt', defaultValue: false)
late bool? opt;
@JsonKey(name: 'reenter', defaultValue: false)
late bool? reenter;
late int? min;
late int? max;
@JsonKey(name: 'max_len')
late int? maxLen;
late bool? rt;
late bool? track;
late String? txt;
@JsonKey(name: 'task_arrival')
late int? taskArrival;
@JsonKey(name: 'task_fin_work')
late int? taskFinWork;
late List<TourEntry>? entries;
bool? opt;
bool? reenter;
int? min;
int? max;
int? maxLen;
bool? rt;
bool? track;
String? txt;
int? taskArrival;
int? taskFinWork;
List<TourEntry>? entries;
TourTask();
factory TourTask.fromJson(Map<String, dynamic> json) => _$TourTaskFromJson(json);
factory TourTask.fromJson(Map<String, dynamic> json) {
final task = TourTask();
task.sId = json['s_id'] as int;
task.type = json['type'] as int;
task.topic = json['topic'] as String;
task.opt = json['opt'] as bool? ?? false;
task.reenter = json['reenter'] as bool? ?? false;
task.min = json['min'] as int?;
task.max = json['max'] as int?;
task.maxLen = json['max_len'] as int?;
task.rt = json['rt'] as bool?;
task.track = json['track'] as bool?;
task.txt = json['txt'] as String?;
task.taskArrival = json['task_arrival'] as int?;
task.taskFinWork = json['task_fin_work'] as int?;
task.entries = json['entries'] != null
? (json['entries'] as List<dynamic>)
.map((e) => TourEntry.fromJson(e as Map<String, dynamic>))
.toList()
: null;
return task;
}
Map<String, dynamic> toJson() => _$TourTaskToJson(this);
Map<String, dynamic> toJson() {
return {
's_id': sId,
'type': type,
'topic': topic,
'opt': opt,
'reenter': reenter,
'min': min,
'max': max,
'max_len': maxLen,
'rt': rt,
'track': track,
'txt': txt,
'task_arrival': taskArrival,
'task_fin_work': taskFinWork,
'entries': entries?.map((e) => e.toJson()).toList(),
};
}
}
@embedded
@JsonSerializable()
class TourEntry {
late int code;
late String text;
@JsonKey(name: 'query_remark')
late bool queryRemark;
TourEntry();
factory TourEntry.fromJson(Map<String, dynamic> json) => _$TourEntryFromJson(json);
factory TourEntry.fromJson(Map<String, dynamic> json) {
final entry = TourEntry();
entry.code = json['code'] as int;
entry.text = json['text'] as String;
entry.queryRemark = json['query_remark'] as bool;
return entry;
}
Map<String, dynamic> toJson() => _$TourEntryToJson(this);
Map<String, dynamic> toJson() {
return {
'code': code,
'text': text,
'query_remark': queryRemark,
};
}
}