change default id to 0
This commit is contained in:
parent
d0082b78ff
commit
250a0e7553
|
@ -14,7 +14,7 @@ class Bucket {
|
|||
final List<Task> 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,
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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<String, dynamic> toJSON() => {
|
||||
'id': id != -1 ? id : null,
|
||||
'id': id,
|
||||
'created': created.toUtc().toIso8601String(),
|
||||
'updated': updated.toUtc().toIso8601String(),
|
||||
'title': title,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Reference in New Issue