2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 21:46:46 +00:00

Adds class representing global and user settings

This commit is contained in:
Oliver Walters 2022-05-09 20:53:12 +10:00
parent 349eca4533
commit da3b668e8c

View File

@ -572,6 +572,50 @@ class InvenTreePlugin extends InvenTreeModel {
} }
/*
* Class representing a 'setting' object on the InvenTree server.
* There are two sorts of settings available from the server, via the API:
* - GlobalSetting (applicable to all users)
* - UserSetting (applicable only to the current user)
*/
class InvenTreeGlobalSetting extends InvenTreeModel {
InvenTreeGlobalSetting() : super();
InvenTreeGlobalSetting.fromJson(Map<String, dynamic> json) : super.fromJson(json);
@override
InvenTreeGlobalSetting createFromJson(Map<String, dynamic> json) {
return InvenTreeGlobalSetting.fromJson(json);
}
@override
String get URL => "settings/global/";
String get key => (jsondata["key"] ?? "") as String;
String get value => (jsondata["value"] ?? "") as String;
String get type => (jsondata["type"] ?? "") as String;
}
class InvenTreeUserSetting extends InvenTreeGlobalSetting {
InvenTreeUserSetting() : super();
InvenTreeUserSetting.fromJson(Map<String, dynamic> json) : super.fromJson(json);
@override
InvenTreeGlobalSetting createFromJson(Map<String, dynamic> json) {
return InvenTreeGlobalSetting.fromJson(json);
}
@override
String get URL => "settings/user/";
}
class InvenTreeAttachment extends InvenTreeModel { class InvenTreeAttachment extends InvenTreeModel {
// Class representing an "attachment" file // Class representing an "attachment" file
InvenTreeAttachment() : super(); InvenTreeAttachment() : super();