ObjectBox
This commit is contained in:
1 parent
e548f62bde
commit
f8317be627
60 files changed
+2367
-15049
No files matched your search
+44
-12
@@ -1,12 +1,6 @@
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:stadtbote/model/tour_position.dart';
|
||||
import 'package:stadtbote/model/tour_task.dart';
|
||||
|
||||
part 'job_tour.g.dart';
|
||||
|
||||
@embedded
|
||||
@JsonSerializable()
|
||||
class JobTour {
|
||||
late int id;
|
||||
late int sort;
|
||||
@@ -14,17 +8,55 @@ class JobTour {
|
||||
late String mode;
|
||||
late String comp;
|
||||
late String person;
|
||||
late String? phone;
|
||||
String? phone;
|
||||
late String street;
|
||||
late String city;
|
||||
late String? com;
|
||||
late TourPosition? pos;
|
||||
String? com;
|
||||
TourPosition? pos;
|
||||
late String rem;
|
||||
late List<TourTask>? tasks;
|
||||
List<TourTask>? tasks;
|
||||
|
||||
JobTour();
|
||||
|
||||
factory JobTour.fromJson(Map<String, dynamic> json) => _$JobTourFromJson(json);
|
||||
factory JobTour.fromJson(Map<String, dynamic> json) {
|
||||
final tour = JobTour();
|
||||
tour.id = json['id'] as int;
|
||||
tour.sort = json['sort'] as int;
|
||||
tour.state = json['state'] as int;
|
||||
tour.mode = json['mode'] as String;
|
||||
tour.comp = json['comp'] as String;
|
||||
tour.person = json['person'] as String;
|
||||
tour.phone = json['phone'] as String?;
|
||||
tour.street = json['street'] as String;
|
||||
tour.city = json['city'] as String;
|
||||
tour.com = json['com'] as String?;
|
||||
tour.pos = json['pos'] != null
|
||||
? TourPosition.fromJson(json['pos'] as Map<String, dynamic>)
|
||||
: null;
|
||||
tour.rem = json['rem'] as String;
|
||||
tour.tasks = json['tasks'] != null
|
||||
? (json['tasks'] as List<dynamic>)
|
||||
.map((e) => TourTask.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
: null;
|
||||
return tour;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => _$JobTourToJson(this);
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'sort': sort,
|
||||
'state': state,
|
||||
'mode': mode,
|
||||
'comp': comp,
|
||||
'person': person,
|
||||
'phone': phone,
|
||||
'street': street,
|
||||
'city': city,
|
||||
'com': com,
|
||||
'pos': pos?.toJson(),
|
||||
'rem': rem,
|
||||
'tasks': tasks?.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user