mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-16 12:15:31 +00:00
Yet more linting
This commit is contained in:
@ -10,6 +10,8 @@ class InvenTreeCompany extends InvenTreeModel {
|
||||
|
||||
InvenTreeCompany() : super();
|
||||
|
||||
InvenTreeCompany.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL => "company/";
|
||||
|
||||
@ -42,8 +44,6 @@ class InvenTreeCompany extends InvenTreeModel {
|
||||
|
||||
bool get isCustomer => (jsondata["is_customer"] ?? false) as bool;
|
||||
|
||||
InvenTreeCompany.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
var company = InvenTreeCompany.fromJson(json);
|
||||
@ -57,6 +57,11 @@ class InvenTreeCompany extends InvenTreeModel {
|
||||
* The InvenTreeSupplierPart class represents the SupplierPart model in the InvenTree database
|
||||
*/
|
||||
class InvenTreeSupplierPart extends InvenTreeModel {
|
||||
|
||||
InvenTreeSupplierPart() : super();
|
||||
|
||||
InvenTreeSupplierPart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL => "company/part/";
|
||||
|
||||
@ -78,10 +83,6 @@ class InvenTreeSupplierPart extends InvenTreeModel {
|
||||
return _filters();
|
||||
}
|
||||
|
||||
InvenTreeSupplierPart() : super();
|
||||
|
||||
InvenTreeSupplierPart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
int get manufacturerId => (jsondata["manufacturer"] ?? -1) as int;
|
||||
|
||||
String get manufacturerName => (jsondata["manufacturer_detail"]["name"] ?? "") as String;
|
||||
@ -117,6 +118,10 @@ class InvenTreeSupplierPart extends InvenTreeModel {
|
||||
|
||||
class InvenTreeManufacturerPart extends InvenTreeModel {
|
||||
|
||||
InvenTreeManufacturerPart() : super();
|
||||
|
||||
InvenTreeManufacturerPart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String url = "company/part/manufacturer/";
|
||||
|
||||
@ -127,10 +132,6 @@ class InvenTreeManufacturerPart extends InvenTreeModel {
|
||||
};
|
||||
}
|
||||
|
||||
InvenTreeManufacturerPart() : super();
|
||||
|
||||
InvenTreeManufacturerPart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
int get partId => (jsondata["part"] ?? -1) as int;
|
||||
|
||||
int get manufacturerId => (jsondata["manufacturer"] ?? -1) as int;
|
||||
|
@ -39,6 +39,11 @@ class InvenTreePageResponse {
|
||||
*/
|
||||
class InvenTreeModel {
|
||||
|
||||
InvenTreeModel();
|
||||
|
||||
// Construct an InvenTreeModel from a JSON data object
|
||||
InvenTreeModel.fromJson(this.jsondata);
|
||||
|
||||
// Override the endpoint URL for each subclass
|
||||
String get URL => "";
|
||||
|
||||
@ -115,19 +120,6 @@ class InvenTreeModel {
|
||||
// Accessor for the API
|
||||
var api = InvenTreeAPI();
|
||||
|
||||
// Default empty object constructor
|
||||
InvenTreeModel() {
|
||||
jsondata.clear();
|
||||
}
|
||||
|
||||
// Construct an InvenTreeModel from a JSON data object
|
||||
InvenTreeModel.fromJson(Map<String, dynamic> json) {
|
||||
|
||||
// Store the json object
|
||||
jsondata = json;
|
||||
|
||||
}
|
||||
|
||||
int get pk => (jsondata["pk"] ?? -1) as int;
|
||||
|
||||
// Some common accessors
|
||||
@ -185,10 +177,14 @@ class InvenTreeModel {
|
||||
|
||||
}
|
||||
|
||||
Map<String, String> defaultListFilters() { return Map<String, String>(); }
|
||||
Map<String, String> defaultListFilters() {
|
||||
return {};
|
||||
}
|
||||
|
||||
// A map of "default" headers to use when performing a GET request
|
||||
Map<String, String> defaultGetFilters() { return Map<String, String>(); }
|
||||
Map<String, String> defaultGetFilters() {
|
||||
return {};
|
||||
}
|
||||
|
||||
/*
|
||||
* Reload this object, by requesting data from the server
|
||||
@ -357,7 +353,7 @@ class InvenTreeModel {
|
||||
}
|
||||
|
||||
// Construct the response
|
||||
InvenTreePageResponse page = new InvenTreePageResponse();
|
||||
InvenTreePageResponse page = InvenTreePageResponse();
|
||||
|
||||
var data = response.asMap();
|
||||
|
||||
@ -458,9 +454,10 @@ class InvenTreeModel {
|
||||
|
||||
class InvenTreeAttachment extends InvenTreeModel {
|
||||
// Class representing an "attachment" file
|
||||
|
||||
InvenTreeAttachment() : super();
|
||||
|
||||
InvenTreeAttachment.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
String get attachment => (jsondata["attachment"] ?? "") as String;
|
||||
|
||||
// Return the filename of the attachment
|
||||
@ -509,8 +506,6 @@ class InvenTreeAttachment extends InvenTreeModel {
|
||||
}
|
||||
}
|
||||
|
||||
InvenTreeAttachment.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
Future<bool> uploadAttachment(File attachment, {String comment = "", Map<String, String> fields = const {}}) async {
|
||||
|
||||
final APIResponse response = await InvenTreeAPI().uploadFile(
|
||||
|
@ -10,6 +10,10 @@ import "model.dart";
|
||||
|
||||
class InvenTreePartCategory extends InvenTreeModel {
|
||||
|
||||
InvenTreePartCategory() : super();
|
||||
|
||||
InvenTreePartCategory.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL => "part/category/";
|
||||
|
||||
@ -25,12 +29,11 @@ class InvenTreePartCategory extends InvenTreeModel {
|
||||
|
||||
@override
|
||||
Map<String, String> defaultListFilters() {
|
||||
var filters = new Map<String, String>();
|
||||
|
||||
filters["active"] = "true";
|
||||
filters["cascade"] = "false";
|
||||
|
||||
return filters;
|
||||
return {
|
||||
"active": "true",
|
||||
"cascade": "false"
|
||||
};
|
||||
}
|
||||
|
||||
String get pathstring => (jsondata["pathstring"] ?? "") as String;
|
||||
@ -54,10 +57,6 @@ class InvenTreePartCategory extends InvenTreeModel {
|
||||
|
||||
int get partcount => (jsondata["parts"] ?? 0) as int;
|
||||
|
||||
InvenTreePartCategory() : super();
|
||||
|
||||
InvenTreePartCategory.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
var cat = InvenTreePartCategory.fromJson(json);
|
||||
@ -71,6 +70,10 @@ class InvenTreePartCategory extends InvenTreeModel {
|
||||
|
||||
class InvenTreePartTestTemplate extends InvenTreeModel {
|
||||
|
||||
InvenTreePartTestTemplate() : super();
|
||||
|
||||
InvenTreePartTestTemplate.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL => "part/test-template/";
|
||||
|
||||
@ -84,10 +87,6 @@ class InvenTreePartTestTemplate extends InvenTreeModel {
|
||||
|
||||
bool get requiresAttachment => (jsondata["requires_attachment"] ?? false) as bool;
|
||||
|
||||
InvenTreePartTestTemplate() : super();
|
||||
|
||||
InvenTreePartTestTemplate.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
var template = InvenTreePartTestTemplate.fromJson(json);
|
||||
@ -123,6 +122,10 @@ class InvenTreePartTestTemplate extends InvenTreeModel {
|
||||
|
||||
class InvenTreePart extends InvenTreeModel {
|
||||
|
||||
InvenTreePart() : super();
|
||||
|
||||
InvenTreePart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL => "part/";
|
||||
|
||||
@ -377,12 +380,6 @@ class InvenTreePart extends InvenTreeModel {
|
||||
// Return the "starred" status of this part
|
||||
bool get starred => (jsondata["starred"] ?? false) as bool;
|
||||
|
||||
InvenTreePart() : super();
|
||||
|
||||
InvenTreePart.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
|
||||
@ -397,11 +394,11 @@ class InvenTreePartAttachment extends InvenTreeAttachment {
|
||||
|
||||
InvenTreePartAttachment() : super();
|
||||
|
||||
InvenTreePartAttachment.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL => "part/attachment/";
|
||||
|
||||
InvenTreePartAttachment.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
return InvenTreePartAttachment.fromJson(json);
|
||||
|
@ -13,6 +13,10 @@ const int PO_STATUS_RETURNED = 60;
|
||||
|
||||
class InvenTreePurchaseOrder extends InvenTreeModel {
|
||||
|
||||
InvenTreePurchaseOrder() : super();
|
||||
|
||||
InvenTreePurchaseOrder.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL => "order/po/";
|
||||
|
||||
@ -28,8 +32,6 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
|
||||
};
|
||||
}
|
||||
|
||||
InvenTreePurchaseOrder() : super();
|
||||
|
||||
@override
|
||||
Map<String, String> defaultGetFilters() {
|
||||
return {
|
||||
@ -102,8 +104,6 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
|
||||
return items;
|
||||
}
|
||||
|
||||
InvenTreePurchaseOrder.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
return InvenTreePurchaseOrder.fromJson(json);
|
||||
@ -111,6 +111,11 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
|
||||
}
|
||||
|
||||
class InvenTreePOLineItem extends InvenTreeModel {
|
||||
|
||||
InvenTreePOLineItem() : super();
|
||||
|
||||
InvenTreePOLineItem.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL => "order/po-line/";
|
||||
|
||||
@ -189,11 +194,6 @@ class InvenTreePOLineItem extends InvenTreeModel {
|
||||
|
||||
Map<String, dynamic> get destinationDetail => (jsondata["destination_detail"] ?? {}) as Map<String, dynamic>;
|
||||
|
||||
InvenTreePOLineItem() : super();
|
||||
|
||||
InvenTreePOLineItem.fromJson(Map<String, dynamic> json)
|
||||
: super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
return InvenTreePOLineItem.fromJson(json);
|
||||
|
@ -12,6 +12,10 @@ import "package:inventree/api.dart";
|
||||
|
||||
class InvenTreeStockItemTestResult extends InvenTreeModel {
|
||||
|
||||
InvenTreeStockItemTestResult() : super();
|
||||
|
||||
InvenTreeStockItemTestResult.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL => "stock/test/";
|
||||
|
||||
@ -41,10 +45,6 @@ class InvenTreeStockItemTestResult extends InvenTreeModel {
|
||||
|
||||
String get date => (jsondata["date"] ?? "") as String;
|
||||
|
||||
InvenTreeStockItemTestResult() : super();
|
||||
|
||||
InvenTreeStockItemTestResult.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeStockItemTestResult createFromJson(Map<String, dynamic> json) {
|
||||
var result = InvenTreeStockItemTestResult.fromJson(json);
|
||||
@ -56,6 +56,10 @@ class InvenTreeStockItemTestResult extends InvenTreeModel {
|
||||
|
||||
class InvenTreeStockItem extends InvenTreeModel {
|
||||
|
||||
InvenTreeStockItem() : super();
|
||||
|
||||
InvenTreeStockItem.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
// Stock status codes
|
||||
static const int OK = 10;
|
||||
static const int ATTENTION = 50;
|
||||
@ -128,33 +132,23 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
@override
|
||||
Map<String, String> defaultGetFilters() {
|
||||
|
||||
var headers = new Map<String, String>();
|
||||
|
||||
headers["part_detail"] = "true";
|
||||
headers["location_detail"] = "true";
|
||||
headers["supplier_detail"] = "true";
|
||||
headers["cascade"] = "false";
|
||||
|
||||
return headers;
|
||||
return {
|
||||
"part_detail": "true",
|
||||
"location_detail": "true",
|
||||
"supplier_detail": "true",
|
||||
"cascade": "false"
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, String> defaultListFilters() {
|
||||
|
||||
var headers = new Map<String, String>();
|
||||
|
||||
headers["part_detail"] = "true";
|
||||
headers["location_detail"] = "true";
|
||||
headers["supplier_detail"] = "true";
|
||||
headers["cascade"] = "false";
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
InvenTreeStockItem() : super();
|
||||
|
||||
InvenTreeStockItem.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
|
||||
// TODO
|
||||
return {
|
||||
"part_detail": "true",
|
||||
"location_detail": "true",
|
||||
"supplier_detail": "true",
|
||||
"cascade": "false"
|
||||
};
|
||||
}
|
||||
|
||||
List<InvenTreePartTestTemplate> testTemplates = [];
|
||||
@ -533,6 +527,10 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
|
||||
class InvenTreeStockLocation extends InvenTreeModel {
|
||||
|
||||
InvenTreeStockLocation() : super();
|
||||
|
||||
InvenTreeStockLocation.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL => "stock/location/";
|
||||
|
||||
@ -566,10 +564,6 @@ class InvenTreeStockLocation extends InvenTreeModel {
|
||||
|
||||
int get itemcount => (jsondata["items"] ?? 0) as int;
|
||||
|
||||
InvenTreeStockLocation() : super();
|
||||
|
||||
InvenTreeStockLocation.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
|
||||
|
Reference in New Issue
Block a user