45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
class Project {
|
|
final int id;
|
|
final String title;
|
|
final String? description;
|
|
final String? goal;
|
|
final String status; // active | completed | archived
|
|
final String? color;
|
|
final String? autoSummary;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
|
|
const Project({
|
|
required this.id,
|
|
required this.title,
|
|
this.description,
|
|
this.goal,
|
|
required this.status,
|
|
this.color,
|
|
this.autoSummary,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
|
|
factory Project.fromJson(Map<String, dynamic> json) => Project(
|
|
id: json['id'] as int,
|
|
title: json['title'] as String? ?? '',
|
|
description: json['description'] as String?,
|
|
goal: json['goal'] as String?,
|
|
status: json['status'] as String? ?? 'active',
|
|
color: json['color'] as String?,
|
|
autoSummary: json['auto_summary'] as String?,
|
|
createdAt: DateTime.parse(json['created_at'] as String),
|
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'title': title,
|
|
'description': description,
|
|
'goal': goal,
|
|
'status': status,
|
|
'color': color,
|
|
'auto_summary': autoSummary,
|
|
};
|
|
}
|