Première grosse version fonctionnel
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
class EmotionEntry {
|
||||
final int? id;
|
||||
final String emotion; // ex: 'Heureux', 'Triste', 'Stressé'
|
||||
final String? note;
|
||||
final DateTime createdAt;
|
||||
|
||||
EmotionEntry({
|
||||
this.id,
|
||||
required this.emotion,
|
||||
this.note,
|
||||
required this.createdAt,
|
||||
});
|
||||
|
||||
factory EmotionEntry.fromJson(Map<String, dynamic> json) {
|
||||
return EmotionEntry(
|
||||
id: json['id'],
|
||||
emotion: json['emotion_name'] ?? json['emotion'] ?? '',
|
||||
note: json['note'],
|
||||
createdAt: DateTime.parse(json['created_at']),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'emotion_name': emotion,
|
||||
'note': note,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user