format
This commit is contained in:
parent
dfdd6bbd36
commit
dc83fc74c4
|
@ -6,13 +6,16 @@ import 'package:vikunja_app/models/task.dart';
|
|||
import 'package:vikunja_app/service/services.dart';
|
||||
|
||||
class LabelTaskBulkAPIService extends APIService
|
||||
implements LabelTaskBulkService {
|
||||
implements LabelTaskBulkService {
|
||||
LabelTaskBulkAPIService(Client client) : super(client);
|
||||
|
||||
@override
|
||||
Future<Label> update(Task task, List<Label> labels) {
|
||||
return client
|
||||
.post('/tasks/${task.id}/labels/bulk', body: LabelTaskBulk(labels: labels).toJSON())
|
||||
.then((labels) { print(labels.toString());});
|
||||
.post('/tasks/${task.id}/labels/bulk',
|
||||
body: LabelTaskBulk(labels: labels).toJSON())
|
||||
.then((labels) {
|
||||
print(labels.toString());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@ class Label {
|
|||
: id = json['id'],
|
||||
title = json['title'],
|
||||
description = json['description'],
|
||||
color = json['hex_color'] == '' ? null : new Color(int.parse(json['hex_color'], radix: 16) + 0xFF000000),
|
||||
color = json['hex_color'] == ''
|
||||
? null
|
||||
: new Color(int.parse(json['hex_color'], radix: 16) + 0xFF000000),
|
||||
updated = DateTime.fromMillisecondsSinceEpoch(json['updated']),
|
||||
created = DateTime.fromMillisecondsSinceEpoch(json['created']),
|
||||
createdBy = User.fromJson(json['created_by']);
|
||||
|
@ -32,7 +34,9 @@ class Label {
|
|||
'id': id,
|
||||
'title': title,
|
||||
'description': description,
|
||||
'hex_color': color?.value == null ? null : color.value.toRadixString(16).padLeft(8, '0').substring(2),
|
||||
'hex_color': color?.value == null
|
||||
? null
|
||||
: color.value.toRadixString(16).padLeft(8, '0').substring(2),
|
||||
'created_by': createdBy?.toJSON(),
|
||||
'updated': updated?.millisecondsSinceEpoch,
|
||||
'created': created?.millisecondsSinceEpoch,
|
||||
|
|
|
@ -9,10 +9,10 @@ class LabelTask {
|
|||
LabelTask({@required this.label, @required this.task});
|
||||
|
||||
LabelTask.fromJson(Map<String, dynamic> json)
|
||||
: label = new Label(id: json['label_id']),
|
||||
task = null;
|
||||
: label = new Label(id: json['label_id']),
|
||||
task = null;
|
||||
|
||||
toJSON() => {
|
||||
'label_id': label.id,
|
||||
};
|
||||
'label_id': label.id,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import'package:meta/meta.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:vikunja_app/models/label.dart';
|
||||
|
||||
class LabelTaskBulk {
|
||||
|
@ -7,9 +7,9 @@ class LabelTaskBulk {
|
|||
LabelTaskBulk({@required this.labels});
|
||||
|
||||
LabelTaskBulk.fromJson(Map<String, dynamic> json)
|
||||
: labels = json['labels']?.map((label) => Label.fromJson(label));
|
||||
: labels = json['labels']?.map((label) => Label.fromJson(label));
|
||||
|
||||
toJSON() => {
|
||||
'labels': labels.map((label) => label.toJSON()).toList(),
|
||||
};
|
||||
'labels': labels.map((label) => label.toJSON()).toList(),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -52,4 +52,4 @@ abstract class LabelTaskService {
|
|||
|
||||
abstract class LabelTaskBulkService {
|
||||
Future<Label> update(Task task, List<Label> labels);
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user