mirror of
https://github.com/go-vikunja/app
synced 2024-06-12 23:52:08 +00:00
31 lines
772 B
Dart
31 lines
772 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
import 'package:vikunja_app/models/user.dart';
|
|
|
|
@JsonSerializable()
|
|
class TaskAttachment {
|
|
final int id, taskId;
|
|
final DateTime created;
|
|
final User createdBy;
|
|
// TODO: add file
|
|
|
|
TaskAttachment({
|
|
this.id = 0,
|
|
required this.taskId,
|
|
DateTime? created,
|
|
required this.createdBy,
|
|
}) : this.created = created ?? DateTime.now();
|
|
|
|
TaskAttachment.fromJSON(Map<String, dynamic> json)
|
|
: id = json['id'],
|
|
taskId = json['task_id'],
|
|
created = DateTime.parse(json['created']),
|
|
createdBy = User.fromJson(json['created_by']);
|
|
|
|
toJSON() => {
|
|
'id': id,
|
|
'task_id': taskId,
|
|
'created': created.toUtc().toIso8601String(),
|
|
'created_by': createdBy.toJSON(),
|
|
};
|
|
} |