change default id to 0

This commit is contained in:
Paul Nettleton 2022-09-07 13:22:42 -05:00
parent d0082b78ff
commit 250a0e7553
7 changed files with 14 additions and 14 deletions

View File

@ -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,

View File

@ -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':

View File

@ -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(),

View File

@ -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,

View File

@ -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,

View File

@ -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(),

View File

@ -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(),