diff --git a/lib/models/bucket.dart b/lib/models/bucket.dart index 1e06857..09055dd 100644 --- a/lib/models/bucket.dart +++ b/lib/models/bucket.dart @@ -14,7 +14,7 @@ class Bucket { final List tasks; Bucket({ - this.id = -1, + this.id = 0, required this.listId, required this.title, this.position, @@ -47,7 +47,7 @@ class Bucket { .toList(); toJSON() => { - 'id': id != -1 ? id : null, + 'id': id, 'list_id': listId, 'title': title, 'position': position, diff --git a/lib/models/label.dart b/lib/models/label.dart index 6c0f153..ee09525 100644 --- a/lib/models/label.dart +++ b/lib/models/label.dart @@ -13,7 +13,7 @@ class Label { late final Color textColor = color != null && color!.computeLuminance() <= 0.5 ? vLabelLight : vLabelDark; Label({ - this.id = -1, + this.id = 0, required this.title, this.description = '', this.color, @@ -35,7 +35,7 @@ class Label { createdBy = User.fromJson(json['created_by']); toJSON() => { - 'id': id != -1 ? id : null, + 'id': id, 'title': title, 'description': description, 'hex_color': diff --git a/lib/models/list.dart b/lib/models/list.dart index 176c263..7acdbd1 100644 --- a/lib/models/list.dart +++ b/lib/models/list.dart @@ -11,7 +11,7 @@ class TaskList { final bool isFavorite; TaskList({ - this.id = -1, + this.id = 0, required this.title, required this.namespaceId, this.description = '', @@ -39,7 +39,7 @@ class TaskList { toJSON() { return { - 'id': id != -1 ? id : null, + 'id': id, 'title': title, 'description': description, 'owner': owner.toJSON(), diff --git a/lib/models/namespace.dart b/lib/models/namespace.dart index 78f601c..cae149a 100644 --- a/lib/models/namespace.dart +++ b/lib/models/namespace.dart @@ -7,7 +7,7 @@ class Namespace { final User owner; Namespace({ - this.id = -1, + this.id = 0, DateTime? created, DateTime? updated, required this.title, @@ -25,7 +25,7 @@ class Namespace { owner = User.fromJson(json['owner']); Map toJSON() => { - 'id': id != -1 ? id : null, + 'id': id, 'created': created.toUtc().toIso8601String(), 'updated': updated.toUtc().toIso8601String(), 'title': title, diff --git a/lib/models/task.dart b/lib/models/task.dart index 45621fd..4724146 100644 --- a/lib/models/task.dart +++ b/lib/models/task.dart @@ -32,7 +32,7 @@ class Task { late final hasDueDate = dueDate?.year != 1; Task({ - this.id = -1, + this.id = 0, this.identifier = '', this.title = '', this.description = '', @@ -104,7 +104,7 @@ class Task { createdBy = User.fromJson(json['created_by']); toJSON() => { - 'id': id != -1 ? id : null, + 'id': id, 'title': title, 'description': description, 'identifier': identifier.isNotEmpty ? identifier : null, diff --git a/lib/models/taskAttachment.dart b/lib/models/taskAttachment.dart index b43eaf1..b0c6cdc 100644 --- a/lib/models/taskAttachment.dart +++ b/lib/models/taskAttachment.dart @@ -10,7 +10,7 @@ class TaskAttachment { // TODO: add file TaskAttachment({ - this.id = -1, + this.id = 0, required this.taskId, DateTime? created, required this.createdBy, @@ -23,7 +23,7 @@ class TaskAttachment { createdBy = User.fromJson(json['created_by']); toJSON() => { - 'id': id != -1 ? id : null, + 'id': id, 'task_id': taskId, 'created': created.toUtc().toIso8601String(), 'created_by': createdBy.toJSON(), diff --git a/lib/models/user.dart b/lib/models/user.dart index c0dc080..fb50549 100644 --- a/lib/models/user.dart +++ b/lib/models/user.dart @@ -7,7 +7,7 @@ class User { final DateTime created, updated; User({ - this.id = -1, + this.id = 0, this.name = '', required this.username, DateTime? created, @@ -23,7 +23,7 @@ class User { updated = DateTime.parse(json['updated']); toJSON() => { - 'id': id != -1 ? id : null, + 'id': id, 'name': name, 'username': username, 'created': created.toUtc().toIso8601String(),