mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-17 12:45:26 +00:00
Add model for notifications
- Display a list of active notifications
This commit is contained in:
31
lib/inventree/notification.dart
Normal file
31
lib/inventree/notification.dart
Normal file
@ -0,0 +1,31 @@
|
||||
import "package:inventree/inventree/model.dart";
|
||||
|
||||
/*
|
||||
* Class representing a "notification"
|
||||
*/
|
||||
|
||||
class InvenTreeNotification extends InvenTreeModel {
|
||||
|
||||
InvenTreeNotification() : super();
|
||||
|
||||
InvenTreeNotification.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeNotification createFromJson(Map<String, dynamic> json) {
|
||||
return InvenTreeNotification.fromJson(json);
|
||||
}
|
||||
|
||||
@override
|
||||
String get URL => "notifications/";
|
||||
|
||||
String get message => (jsondata["message"] ?? "") as String;
|
||||
|
||||
DateTime? get creationDate {
|
||||
if (jsondata.containsKey("creation")) {
|
||||
return DateTime.tryParse((jsondata["creation"] ?? "") as String);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user