From 40ef71a28b419b9296c4eea18169fb258b257f4c Mon Sep 17 00:00:00 2001 From: mandreshope Date: Tue, 29 Jul 2025 10:09:03 +0300 Subject: [PATCH] refactor: Standardizes data model naming convention Renames `AuthStruct` to `AuthModel` and `ProductStruct` to `ProductModel` to align with a consistent data model naming convention. Updates all relevant imports, type declarations, and method signatures across the application to reflect these changes, improving codebase clarity and maintainability. Includes minor code style improvements and refactorings in other components. --- lib/backend/api/api_calls.dart | 6 +- .../entities/product/product_entity.dart | 10 +- .../{auth_struct.dart => auth_model.dart} | 14 +- ...t.freezed.dart => auth_model.freezed.dart} | 60 +- .../{auth_struct.g.dart => auth_model.g.dart} | 4 +- ...product_struct.dart => product_model.dart} | 16 +- ...reezed.dart => product_model.freezed.dart} | 64 +- ...uct_struct.g.dart => product_model.g.dart} | 8 +- .../stock_picking/stock_picking_model.dart | 75 ++ .../stock_picking_model.freezed.dart | 826 ++++++++++++++++++ .../stock_picking/stock_picking_model.g.dart | 100 +++ lib/components/drawer_component.dart | 3 +- lib/components/product_scanned_component.dart | 4 +- lib/pages/login/login_page_model.dart | 4 +- lib/pages/scanner/scanner_page.dart | 6 +- lib/services/dio_service.dart | 4 +- 16 files changed, 1102 insertions(+), 102 deletions(-) rename lib/backend/schema/auth/{auth_struct.dart => auth_model.dart} (52%) rename lib/backend/schema/auth/{auth_struct.freezed.dart => auth_model.freezed.dart} (68%) rename lib/backend/schema/auth/{auth_struct.g.dart => auth_model.g.dart} (82%) rename lib/backend/schema/product/{product_struct.dart => product_model.dart} (61%) rename lib/backend/schema/product/{product_struct.freezed.dart => product_model.freezed.dart} (66%) rename lib/backend/schema/product/{product_struct.g.dart => product_model.g.dart} (80%) create mode 100644 lib/backend/schema/stock_picking/stock_picking_model.dart create mode 100644 lib/backend/schema/stock_picking/stock_picking_model.freezed.dart create mode 100644 lib/backend/schema/stock_picking/stock_picking_model.g.dart diff --git a/lib/backend/api/api_calls.dart b/lib/backend/api/api_calls.dart index 8817b41..6bf0eed 100644 --- a/lib/backend/api/api_calls.dart +++ b/lib/backend/api/api_calls.dart @@ -1,4 +1,4 @@ -import 'package:barcode_scanner/backend/schema/auth/auth_struct.dart'; +import 'package:barcode_scanner/backend/schema/auth/auth_model.dart'; import 'package:barcode_scanner/provider_container.dart'; import 'package:barcode_scanner/services/dio_service.dart'; import 'package:barcode_scanner/services/token_provider.dart'; @@ -36,7 +36,7 @@ class ApiCalls { } } - static Future> signIn({ + static Future> signIn({ required String email, required String password, }) async { @@ -54,7 +54,7 @@ class ApiCalls { if (response.statusCode == 200) { final data = response.data; if (data['result']['success'] == true) { - return Result.success(AuthStruct.fromJson(data['result']['data'])); + return Result.success(AuthModel.fromJson(data['result']['data'])); } else { return Result.error(Error(data['result']['success'])); } diff --git a/lib/backend/objectbox/entities/product/product_entity.dart b/lib/backend/objectbox/entities/product/product_entity.dart index faf2de1..49819a6 100644 --- a/lib/backend/objectbox/entities/product/product_entity.dart +++ b/lib/backend/objectbox/entities/product/product_entity.dart @@ -1,4 +1,4 @@ -import 'package:barcode_scanner/backend/schema/product/product_struct.dart'; +import 'package:barcode_scanner/backend/schema/product/product_model.dart'; import 'package:objectbox/objectbox.dart'; /// Modèle de base de données ObjectBox @@ -23,9 +23,9 @@ class ProductEntity { String? quantity; String? image; - /// Convertir vers ProductStruct - ProductStruct toStruct() { - return ProductStruct( + /// Convertir vers ProductModel + ProductModel toStruct() { + return ProductModel( id: id, code: code, name: name, @@ -37,7 +37,7 @@ class ProductEntity { } /// Créer une instance de ProductEntity à partir de ProductStruct - static ProductEntity fromStruct(ProductStruct struct) { + static ProductEntity fromStruct(ProductModel struct) { return ProductEntity( id: struct.id, code: struct.code, diff --git a/lib/backend/schema/auth/auth_struct.dart b/lib/backend/schema/auth/auth_model.dart similarity index 52% rename from lib/backend/schema/auth/auth_struct.dart rename to lib/backend/schema/auth/auth_model.dart index c1f170f..fa6be78 100644 --- a/lib/backend/schema/auth/auth_struct.dart +++ b/lib/backend/schema/auth/auth_model.dart @@ -1,19 +1,19 @@ import 'package:freezed_annotation/freezed_annotation.dart'; -part 'auth_struct.freezed.dart'; -part 'auth_struct.g.dart'; +part 'auth_model.freezed.dart'; +part 'auth_model.g.dart'; @Freezed(toJson: false) -abstract class AuthStruct with _$AuthStruct { - factory AuthStruct({ +abstract class AuthModel with _$AuthModel { + factory AuthModel({ @JsonKey(name: 'access_token') String? accessToken, @JsonKey(name: 'db_name') String? dbName, int? uid, String? refreshToken, String? name, String? username, - }) = _AuthStruct; + }) = _AuthModel; - factory AuthStruct.fromJson(Map json) => - _$AuthStructFromJson(json); + factory AuthModel.fromJson(Map json) => + _$AuthModelFromJson(json); } diff --git a/lib/backend/schema/auth/auth_struct.freezed.dart b/lib/backend/schema/auth/auth_model.freezed.dart similarity index 68% rename from lib/backend/schema/auth/auth_struct.freezed.dart rename to lib/backend/schema/auth/auth_model.freezed.dart index a3e0217..3e512f9 100644 --- a/lib/backend/schema/auth/auth_struct.freezed.dart +++ b/lib/backend/schema/auth/auth_model.freezed.dart @@ -4,7 +4,7 @@ // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark -part of 'auth_struct.dart'; +part of 'auth_model.dart'; // ************************************************************************** // FreezedGenerator @@ -14,20 +14,20 @@ part of 'auth_struct.dart'; T _$identity(T value) => value; /// @nodoc -mixin _$AuthStruct { +mixin _$AuthModel { @JsonKey(name: 'access_token') String? get accessToken;@JsonKey(name: 'db_name') String? get dbName; int? get uid; String? get refreshToken; String? get name; String? get username; -/// Create a copy of AuthStruct +/// Create a copy of AuthModel /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -$AuthStructCopyWith get copyWith => _$AuthStructCopyWithImpl(this as AuthStruct, _$identity); +$AuthModelCopyWith get copyWith => _$AuthModelCopyWithImpl(this as AuthModel, _$identity); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is AuthStruct&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.dbName, dbName) || other.dbName == dbName)&&(identical(other.uid, uid) || other.uid == uid)&&(identical(other.refreshToken, refreshToken) || other.refreshToken == refreshToken)&&(identical(other.name, name) || other.name == name)&&(identical(other.username, username) || other.username == username)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is AuthModel&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.dbName, dbName) || other.dbName == dbName)&&(identical(other.uid, uid) || other.uid == uid)&&(identical(other.refreshToken, refreshToken) || other.refreshToken == refreshToken)&&(identical(other.name, name) || other.name == name)&&(identical(other.username, username) || other.username == username)); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -36,15 +36,15 @@ int get hashCode => Object.hash(runtimeType,accessToken,dbName,uid,refreshToken, @override String toString() { - return 'AuthStruct(accessToken: $accessToken, dbName: $dbName, uid: $uid, refreshToken: $refreshToken, name: $name, username: $username)'; + return 'AuthModel(accessToken: $accessToken, dbName: $dbName, uid: $uid, refreshToken: $refreshToken, name: $name, username: $username)'; } } /// @nodoc -abstract mixin class $AuthStructCopyWith<$Res> { - factory $AuthStructCopyWith(AuthStruct value, $Res Function(AuthStruct) _then) = _$AuthStructCopyWithImpl; +abstract mixin class $AuthModelCopyWith<$Res> { + factory $AuthModelCopyWith(AuthModel value, $Res Function(AuthModel) _then) = _$AuthModelCopyWithImpl; @useResult $Res call({ @JsonKey(name: 'access_token') String? accessToken,@JsonKey(name: 'db_name') String? dbName, int? uid, String? refreshToken, String? name, String? username @@ -55,14 +55,14 @@ $Res call({ } /// @nodoc -class _$AuthStructCopyWithImpl<$Res> - implements $AuthStructCopyWith<$Res> { - _$AuthStructCopyWithImpl(this._self, this._then); +class _$AuthModelCopyWithImpl<$Res> + implements $AuthModelCopyWith<$Res> { + _$AuthModelCopyWithImpl(this._self, this._then); - final AuthStruct _self; - final $Res Function(AuthStruct) _then; + final AuthModel _self; + final $Res Function(AuthModel) _then; -/// Create a copy of AuthStruct +/// Create a copy of AuthModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? accessToken = freezed,Object? dbName = freezed,Object? uid = freezed,Object? refreshToken = freezed,Object? name = freezed,Object? username = freezed,}) { return _then(_self.copyWith( @@ -82,9 +82,9 @@ as String?, /// @nodoc @JsonSerializable(createToJson: false) -class _AuthStruct implements AuthStruct { - _AuthStruct({@JsonKey(name: 'access_token') this.accessToken, @JsonKey(name: 'db_name') this.dbName, this.uid, this.refreshToken, this.name, this.username}); - factory _AuthStruct.fromJson(Map json) => _$AuthStructFromJson(json); +class _AuthModel implements AuthModel { + _AuthModel({@JsonKey(name: 'access_token') this.accessToken, @JsonKey(name: 'db_name') this.dbName, this.uid, this.refreshToken, this.name, this.username}); + factory _AuthModel.fromJson(Map json) => _$AuthModelFromJson(json); @override@JsonKey(name: 'access_token') final String? accessToken; @override@JsonKey(name: 'db_name') final String? dbName; @@ -93,17 +93,17 @@ class _AuthStruct implements AuthStruct { @override final String? name; @override final String? username; -/// Create a copy of AuthStruct +/// Create a copy of AuthModel /// with the given fields replaced by the non-null parameter values. @override @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -_$AuthStructCopyWith<_AuthStruct> get copyWith => __$AuthStructCopyWithImpl<_AuthStruct>(this, _$identity); +_$AuthModelCopyWith<_AuthModel> get copyWith => __$AuthModelCopyWithImpl<_AuthModel>(this, _$identity); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _AuthStruct&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.dbName, dbName) || other.dbName == dbName)&&(identical(other.uid, uid) || other.uid == uid)&&(identical(other.refreshToken, refreshToken) || other.refreshToken == refreshToken)&&(identical(other.name, name) || other.name == name)&&(identical(other.username, username) || other.username == username)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _AuthModel&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.dbName, dbName) || other.dbName == dbName)&&(identical(other.uid, uid) || other.uid == uid)&&(identical(other.refreshToken, refreshToken) || other.refreshToken == refreshToken)&&(identical(other.name, name) || other.name == name)&&(identical(other.username, username) || other.username == username)); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -112,15 +112,15 @@ int get hashCode => Object.hash(runtimeType,accessToken,dbName,uid,refreshToken, @override String toString() { - return 'AuthStruct(accessToken: $accessToken, dbName: $dbName, uid: $uid, refreshToken: $refreshToken, name: $name, username: $username)'; + return 'AuthModel(accessToken: $accessToken, dbName: $dbName, uid: $uid, refreshToken: $refreshToken, name: $name, username: $username)'; } } /// @nodoc -abstract mixin class _$AuthStructCopyWith<$Res> implements $AuthStructCopyWith<$Res> { - factory _$AuthStructCopyWith(_AuthStruct value, $Res Function(_AuthStruct) _then) = __$AuthStructCopyWithImpl; +abstract mixin class _$AuthModelCopyWith<$Res> implements $AuthModelCopyWith<$Res> { + factory _$AuthModelCopyWith(_AuthModel value, $Res Function(_AuthModel) _then) = __$AuthModelCopyWithImpl; @override @useResult $Res call({ @JsonKey(name: 'access_token') String? accessToken,@JsonKey(name: 'db_name') String? dbName, int? uid, String? refreshToken, String? name, String? username @@ -131,17 +131,17 @@ $Res call({ } /// @nodoc -class __$AuthStructCopyWithImpl<$Res> - implements _$AuthStructCopyWith<$Res> { - __$AuthStructCopyWithImpl(this._self, this._then); +class __$AuthModelCopyWithImpl<$Res> + implements _$AuthModelCopyWith<$Res> { + __$AuthModelCopyWithImpl(this._self, this._then); - final _AuthStruct _self; - final $Res Function(_AuthStruct) _then; + final _AuthModel _self; + final $Res Function(_AuthModel) _then; -/// Create a copy of AuthStruct +/// Create a copy of AuthModel /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $Res call({Object? accessToken = freezed,Object? dbName = freezed,Object? uid = freezed,Object? refreshToken = freezed,Object? name = freezed,Object? username = freezed,}) { - return _then(_AuthStruct( + return _then(_AuthModel( accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable as String?,dbName: freezed == dbName ? _self.dbName : dbName // ignore: cast_nullable_to_non_nullable as String?,uid: freezed == uid ? _self.uid : uid // ignore: cast_nullable_to_non_nullable diff --git a/lib/backend/schema/auth/auth_struct.g.dart b/lib/backend/schema/auth/auth_model.g.dart similarity index 82% rename from lib/backend/schema/auth/auth_struct.g.dart rename to lib/backend/schema/auth/auth_model.g.dart index 7e1b177..2dc42a0 100644 --- a/lib/backend/schema/auth/auth_struct.g.dart +++ b/lib/backend/schema/auth/auth_model.g.dart @@ -1,12 +1,12 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'auth_struct.dart'; +part of 'auth_model.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -_AuthStruct _$AuthStructFromJson(Map json) => _AuthStruct( +_AuthModel _$AuthModelFromJson(Map json) => _AuthModel( accessToken: json['access_token'] as String?, dbName: json['db_name'] as String?, uid: (json['uid'] as num?)?.toInt(), diff --git a/lib/backend/schema/product/product_struct.dart b/lib/backend/schema/product/product_model.dart similarity index 61% rename from lib/backend/schema/product/product_struct.dart rename to lib/backend/schema/product/product_model.dart index 901233e..371d384 100644 --- a/lib/backend/schema/product/product_struct.dart +++ b/lib/backend/schema/product/product_model.dart @@ -1,12 +1,12 @@ import 'package:barcode_scanner/backend/objectbox/entities/product/product_entity.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; -part 'product_struct.freezed.dart'; -part 'product_struct.g.dart'; +part 'product_model.freezed.dart'; +part 'product_model.g.dart'; @Freezed(toJson: true) -abstract class ProductStruct with _$ProductStruct { - factory ProductStruct({ +abstract class ProductModel with _$ProductModel { + factory ProductModel({ @Default(0) int id, String? code, String? name, @@ -14,13 +14,13 @@ abstract class ProductStruct with _$ProductStruct { String? price, String? quantity, String? image, - }) = _ProductStruct; + }) = _ProductModel; - factory ProductStruct.fromJson(Map json) => - _$ProductStructFromJson(json); + factory ProductModel.fromJson(Map json) => + _$ProductModelFromJson(json); } -extension ProductStructExt on ProductStruct { +extension ProductModelExt on ProductModel { ProductEntity get toEntity => ProductEntity( id: id, name: name, diff --git a/lib/backend/schema/product/product_struct.freezed.dart b/lib/backend/schema/product/product_model.freezed.dart similarity index 66% rename from lib/backend/schema/product/product_struct.freezed.dart rename to lib/backend/schema/product/product_model.freezed.dart index 317d4f7..097f31e 100644 --- a/lib/backend/schema/product/product_struct.freezed.dart +++ b/lib/backend/schema/product/product_model.freezed.dart @@ -4,7 +4,7 @@ // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark -part of 'product_struct.dart'; +part of 'product_model.dart'; // ************************************************************************** // FreezedGenerator @@ -14,22 +14,22 @@ part of 'product_struct.dart'; T _$identity(T value) => value; /// @nodoc -mixin _$ProductStruct { +mixin _$ProductModel { int get id; String? get code; String? get name; String? get description; String? get price; String? get quantity; String? get image; -/// Create a copy of ProductStruct +/// Create a copy of ProductModel /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -$ProductStructCopyWith get copyWith => _$ProductStructCopyWithImpl(this as ProductStruct, _$identity); +$ProductModelCopyWith get copyWith => _$ProductModelCopyWithImpl(this as ProductModel, _$identity); - /// Serializes this ProductStruct to a JSON map. + /// Serializes this ProductModel to a JSON map. Map toJson(); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ProductStruct&&(identical(other.id, id) || other.id == id)&&(identical(other.code, code) || other.code == code)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.price, price) || other.price == price)&&(identical(other.quantity, quantity) || other.quantity == quantity)&&(identical(other.image, image) || other.image == image)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is ProductModel&&(identical(other.id, id) || other.id == id)&&(identical(other.code, code) || other.code == code)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.price, price) || other.price == price)&&(identical(other.quantity, quantity) || other.quantity == quantity)&&(identical(other.image, image) || other.image == image)); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -38,15 +38,15 @@ int get hashCode => Object.hash(runtimeType,id,code,name,description,price,quant @override String toString() { - return 'ProductStruct(id: $id, code: $code, name: $name, description: $description, price: $price, quantity: $quantity, image: $image)'; + return 'ProductModel(id: $id, code: $code, name: $name, description: $description, price: $price, quantity: $quantity, image: $image)'; } } /// @nodoc -abstract mixin class $ProductStructCopyWith<$Res> { - factory $ProductStructCopyWith(ProductStruct value, $Res Function(ProductStruct) _then) = _$ProductStructCopyWithImpl; +abstract mixin class $ProductModelCopyWith<$Res> { + factory $ProductModelCopyWith(ProductModel value, $Res Function(ProductModel) _then) = _$ProductModelCopyWithImpl; @useResult $Res call({ int id, String? code, String? name, String? description, String? price, String? quantity, String? image @@ -57,14 +57,14 @@ $Res call({ } /// @nodoc -class _$ProductStructCopyWithImpl<$Res> - implements $ProductStructCopyWith<$Res> { - _$ProductStructCopyWithImpl(this._self, this._then); +class _$ProductModelCopyWithImpl<$Res> + implements $ProductModelCopyWith<$Res> { + _$ProductModelCopyWithImpl(this._self, this._then); - final ProductStruct _self; - final $Res Function(ProductStruct) _then; + final ProductModel _self; + final $Res Function(ProductModel) _then; -/// Create a copy of ProductStruct +/// Create a copy of ProductModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? code = freezed,Object? name = freezed,Object? description = freezed,Object? price = freezed,Object? quantity = freezed,Object? image = freezed,}) { return _then(_self.copyWith( @@ -85,9 +85,9 @@ as String?, /// @nodoc @JsonSerializable() -class _ProductStruct implements ProductStruct { - _ProductStruct({this.id = 0, this.code, this.name, this.description, this.price, this.quantity, this.image}); - factory _ProductStruct.fromJson(Map json) => _$ProductStructFromJson(json); +class _ProductModel implements ProductModel { + _ProductModel({this.id = 0, this.code, this.name, this.description, this.price, this.quantity, this.image}); + factory _ProductModel.fromJson(Map json) => _$ProductModelFromJson(json); @override@JsonKey() final int id; @override final String? code; @@ -97,20 +97,20 @@ class _ProductStruct implements ProductStruct { @override final String? quantity; @override final String? image; -/// Create a copy of ProductStruct +/// Create a copy of ProductModel /// with the given fields replaced by the non-null parameter values. @override @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -_$ProductStructCopyWith<_ProductStruct> get copyWith => __$ProductStructCopyWithImpl<_ProductStruct>(this, _$identity); +_$ProductModelCopyWith<_ProductModel> get copyWith => __$ProductModelCopyWithImpl<_ProductModel>(this, _$identity); @override Map toJson() { - return _$ProductStructToJson(this, ); + return _$ProductModelToJson(this, ); } @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _ProductStruct&&(identical(other.id, id) || other.id == id)&&(identical(other.code, code) || other.code == code)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.price, price) || other.price == price)&&(identical(other.quantity, quantity) || other.quantity == quantity)&&(identical(other.image, image) || other.image == image)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ProductModel&&(identical(other.id, id) || other.id == id)&&(identical(other.code, code) || other.code == code)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.price, price) || other.price == price)&&(identical(other.quantity, quantity) || other.quantity == quantity)&&(identical(other.image, image) || other.image == image)); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -119,15 +119,15 @@ int get hashCode => Object.hash(runtimeType,id,code,name,description,price,quant @override String toString() { - return 'ProductStruct(id: $id, code: $code, name: $name, description: $description, price: $price, quantity: $quantity, image: $image)'; + return 'ProductModel(id: $id, code: $code, name: $name, description: $description, price: $price, quantity: $quantity, image: $image)'; } } /// @nodoc -abstract mixin class _$ProductStructCopyWith<$Res> implements $ProductStructCopyWith<$Res> { - factory _$ProductStructCopyWith(_ProductStruct value, $Res Function(_ProductStruct) _then) = __$ProductStructCopyWithImpl; +abstract mixin class _$ProductModelCopyWith<$Res> implements $ProductModelCopyWith<$Res> { + factory _$ProductModelCopyWith(_ProductModel value, $Res Function(_ProductModel) _then) = __$ProductModelCopyWithImpl; @override @useResult $Res call({ int id, String? code, String? name, String? description, String? price, String? quantity, String? image @@ -138,17 +138,17 @@ $Res call({ } /// @nodoc -class __$ProductStructCopyWithImpl<$Res> - implements _$ProductStructCopyWith<$Res> { - __$ProductStructCopyWithImpl(this._self, this._then); +class __$ProductModelCopyWithImpl<$Res> + implements _$ProductModelCopyWith<$Res> { + __$ProductModelCopyWithImpl(this._self, this._then); - final _ProductStruct _self; - final $Res Function(_ProductStruct) _then; + final _ProductModel _self; + final $Res Function(_ProductModel) _then; -/// Create a copy of ProductStruct +/// Create a copy of ProductModel /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? code = freezed,Object? name = freezed,Object? description = freezed,Object? price = freezed,Object? quantity = freezed,Object? image = freezed,}) { - return _then(_ProductStruct( + return _then(_ProductModel( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as int,code: freezed == code ? _self.code : code // ignore: cast_nullable_to_non_nullable as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable diff --git a/lib/backend/schema/product/product_struct.g.dart b/lib/backend/schema/product/product_model.g.dart similarity index 80% rename from lib/backend/schema/product/product_struct.g.dart rename to lib/backend/schema/product/product_model.g.dart index 5e5403a..8e5c6ae 100644 --- a/lib/backend/schema/product/product_struct.g.dart +++ b/lib/backend/schema/product/product_model.g.dart @@ -1,13 +1,13 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'product_struct.dart'; +part of 'product_model.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -_ProductStruct _$ProductStructFromJson(Map json) => - _ProductStruct( +_ProductModel _$ProductModelFromJson(Map json) => + _ProductModel( id: (json['id'] as num?)?.toInt() ?? 0, code: json['code'] as String?, name: json['name'] as String?, @@ -17,7 +17,7 @@ _ProductStruct _$ProductStructFromJson(Map json) => image: json['image'] as String?, ); -Map _$ProductStructToJson(_ProductStruct instance) => +Map _$ProductModelToJson(_ProductModel instance) => { 'id': instance.id, 'code': instance.code, diff --git a/lib/backend/schema/stock_picking/stock_picking_model.dart b/lib/backend/schema/stock_picking/stock_picking_model.dart new file mode 100644 index 0000000..bf2b008 --- /dev/null +++ b/lib/backend/schema/stock_picking/stock_picking_model.dart @@ -0,0 +1,75 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'stock_picking_model.freezed.dart'; +part 'stock_picking_model.g.dart'; + +@freezed +abstract class StockPickingResponse with _$StockPickingResponse { + const factory StockPickingResponse({ + required String jsonrpc, + required int id, + required StockPickingResult result, + }) = _StockPickingResponse; + + factory StockPickingResponse.fromJson(Map json) => + _$StockPickingResponseFromJson(json); +} + +@freezed +abstract class StockPickingResult with _$StockPickingResult { + const factory StockPickingResult({ + required int length, + required List records, + }) = _StockPickingResult; + + factory StockPickingResult.fromJson(Map json) => + _$StockPickingResultFromJson(json); +} + +@freezed +abstract class StockPickingRecord with _$StockPickingRecord { + const factory StockPickingRecord({ + required int id, + @JsonKey(name: 'company_id') required IdOnly companyId, + required String priority, + required String name, + @JsonKey(name: 'partner_id') required DisplayNameId partnerId, + @JsonKey(name: 'user_id') dynamic userId, // peut être false ou null + @JsonKey(name: 'scheduled_date') required String scheduledDate, + @JsonKey(name: 'picking_type_code') required String pickingTypeCode, + @JsonKey(name: 'products_availability_state') + dynamic productsAvailabilityState, + @JsonKey(name: 'products_availability') dynamic productsAvailability, + @JsonKey(name: 'date_deadline') required String dateDeadline, + @JsonKey(name: 'date_done') dynamic dateDone, + required String origin, + @JsonKey(name: 'backorder_id') dynamic backorderId, + @JsonKey(name: 'picking_type_id') required DisplayNameId pickingTypeId, + required String state, + @JsonKey(name: 'activity_exception_decoration') + dynamic activityExceptionDecoration, + @JsonKey(name: 'activity_exception_icon') dynamic activityExceptionIcon, + @JsonKey(name: 'json_popover') dynamic jsonPopover, + }) = _StockPickingRecord; + + factory StockPickingRecord.fromJson(Map json) => + _$StockPickingRecordFromJson(json); +} + +@freezed +abstract class IdOnly with _$IdOnly { + const factory IdOnly({required int id}) = _IdOnly; + + factory IdOnly.fromJson(Map json) => _$IdOnlyFromJson(json); +} + +@freezed +abstract class DisplayNameId with _$DisplayNameId { + const factory DisplayNameId({ + required int id, + @JsonKey(name: 'display_name') required String displayName, + }) = _DisplayNameId; + + factory DisplayNameId.fromJson(Map json) => + _$DisplayNameIdFromJson(json); +} diff --git a/lib/backend/schema/stock_picking/stock_picking_model.freezed.dart b/lib/backend/schema/stock_picking/stock_picking_model.freezed.dart new file mode 100644 index 0000000..991aa08 --- /dev/null +++ b/lib/backend/schema/stock_picking/stock_picking_model.freezed.dart @@ -0,0 +1,826 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'stock_picking_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$StockPickingResponse { + + String get jsonrpc; int get id; StockPickingResult get result; +/// Create a copy of StockPickingResponse +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$StockPickingResponseCopyWith get copyWith => _$StockPickingResponseCopyWithImpl(this as StockPickingResponse, _$identity); + + /// Serializes this StockPickingResponse to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is StockPickingResponse&&(identical(other.jsonrpc, jsonrpc) || other.jsonrpc == jsonrpc)&&(identical(other.id, id) || other.id == id)&&(identical(other.result, result) || other.result == result)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,jsonrpc,id,result); + +@override +String toString() { + return 'StockPickingResponse(jsonrpc: $jsonrpc, id: $id, result: $result)'; +} + + +} + +/// @nodoc +abstract mixin class $StockPickingResponseCopyWith<$Res> { + factory $StockPickingResponseCopyWith(StockPickingResponse value, $Res Function(StockPickingResponse) _then) = _$StockPickingResponseCopyWithImpl; +@useResult +$Res call({ + String jsonrpc, int id, StockPickingResult result +}); + + +$StockPickingResultCopyWith<$Res> get result; + +} +/// @nodoc +class _$StockPickingResponseCopyWithImpl<$Res> + implements $StockPickingResponseCopyWith<$Res> { + _$StockPickingResponseCopyWithImpl(this._self, this._then); + + final StockPickingResponse _self; + final $Res Function(StockPickingResponse) _then; + +/// Create a copy of StockPickingResponse +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? jsonrpc = null,Object? id = null,Object? result = null,}) { + return _then(_self.copyWith( +jsonrpc: null == jsonrpc ? _self.jsonrpc : jsonrpc // ignore: cast_nullable_to_non_nullable +as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,result: null == result ? _self.result : result // ignore: cast_nullable_to_non_nullable +as StockPickingResult, + )); +} +/// Create a copy of StockPickingResponse +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$StockPickingResultCopyWith<$Res> get result { + + return $StockPickingResultCopyWith<$Res>(_self.result, (value) { + return _then(_self.copyWith(result: value)); + }); +} +} + + +/// @nodoc +@JsonSerializable() + +class _StockPickingResponse implements StockPickingResponse { + const _StockPickingResponse({required this.jsonrpc, required this.id, required this.result}); + factory _StockPickingResponse.fromJson(Map json) => _$StockPickingResponseFromJson(json); + +@override final String jsonrpc; +@override final int id; +@override final StockPickingResult result; + +/// Create a copy of StockPickingResponse +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$StockPickingResponseCopyWith<_StockPickingResponse> get copyWith => __$StockPickingResponseCopyWithImpl<_StockPickingResponse>(this, _$identity); + +@override +Map toJson() { + return _$StockPickingResponseToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _StockPickingResponse&&(identical(other.jsonrpc, jsonrpc) || other.jsonrpc == jsonrpc)&&(identical(other.id, id) || other.id == id)&&(identical(other.result, result) || other.result == result)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,jsonrpc,id,result); + +@override +String toString() { + return 'StockPickingResponse(jsonrpc: $jsonrpc, id: $id, result: $result)'; +} + + +} + +/// @nodoc +abstract mixin class _$StockPickingResponseCopyWith<$Res> implements $StockPickingResponseCopyWith<$Res> { + factory _$StockPickingResponseCopyWith(_StockPickingResponse value, $Res Function(_StockPickingResponse) _then) = __$StockPickingResponseCopyWithImpl; +@override @useResult +$Res call({ + String jsonrpc, int id, StockPickingResult result +}); + + +@override $StockPickingResultCopyWith<$Res> get result; + +} +/// @nodoc +class __$StockPickingResponseCopyWithImpl<$Res> + implements _$StockPickingResponseCopyWith<$Res> { + __$StockPickingResponseCopyWithImpl(this._self, this._then); + + final _StockPickingResponse _self; + final $Res Function(_StockPickingResponse) _then; + +/// Create a copy of StockPickingResponse +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? jsonrpc = null,Object? id = null,Object? result = null,}) { + return _then(_StockPickingResponse( +jsonrpc: null == jsonrpc ? _self.jsonrpc : jsonrpc // ignore: cast_nullable_to_non_nullable +as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,result: null == result ? _self.result : result // ignore: cast_nullable_to_non_nullable +as StockPickingResult, + )); +} + +/// Create a copy of StockPickingResponse +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$StockPickingResultCopyWith<$Res> get result { + + return $StockPickingResultCopyWith<$Res>(_self.result, (value) { + return _then(_self.copyWith(result: value)); + }); +} +} + + +/// @nodoc +mixin _$StockPickingResult { + + int get length; List get records; +/// Create a copy of StockPickingResult +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$StockPickingResultCopyWith get copyWith => _$StockPickingResultCopyWithImpl(this as StockPickingResult, _$identity); + + /// Serializes this StockPickingResult to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is StockPickingResult&&(identical(other.length, length) || other.length == length)&&const DeepCollectionEquality().equals(other.records, records)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,length,const DeepCollectionEquality().hash(records)); + +@override +String toString() { + return 'StockPickingResult(length: $length, records: $records)'; +} + + +} + +/// @nodoc +abstract mixin class $StockPickingResultCopyWith<$Res> { + factory $StockPickingResultCopyWith(StockPickingResult value, $Res Function(StockPickingResult) _then) = _$StockPickingResultCopyWithImpl; +@useResult +$Res call({ + int length, List records +}); + + + + +} +/// @nodoc +class _$StockPickingResultCopyWithImpl<$Res> + implements $StockPickingResultCopyWith<$Res> { + _$StockPickingResultCopyWithImpl(this._self, this._then); + + final StockPickingResult _self; + final $Res Function(StockPickingResult) _then; + +/// Create a copy of StockPickingResult +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? length = null,Object? records = null,}) { + return _then(_self.copyWith( +length: null == length ? _self.length : length // ignore: cast_nullable_to_non_nullable +as int,records: null == records ? _self.records : records // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// @nodoc +@JsonSerializable() + +class _StockPickingResult implements StockPickingResult { + const _StockPickingResult({required this.length, required final List records}): _records = records; + factory _StockPickingResult.fromJson(Map json) => _$StockPickingResultFromJson(json); + +@override final int length; + final List _records; +@override List get records { + if (_records is EqualUnmodifiableListView) return _records; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_records); +} + + +/// Create a copy of StockPickingResult +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$StockPickingResultCopyWith<_StockPickingResult> get copyWith => __$StockPickingResultCopyWithImpl<_StockPickingResult>(this, _$identity); + +@override +Map toJson() { + return _$StockPickingResultToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _StockPickingResult&&(identical(other.length, length) || other.length == length)&&const DeepCollectionEquality().equals(other._records, _records)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,length,const DeepCollectionEquality().hash(_records)); + +@override +String toString() { + return 'StockPickingResult(length: $length, records: $records)'; +} + + +} + +/// @nodoc +abstract mixin class _$StockPickingResultCopyWith<$Res> implements $StockPickingResultCopyWith<$Res> { + factory _$StockPickingResultCopyWith(_StockPickingResult value, $Res Function(_StockPickingResult) _then) = __$StockPickingResultCopyWithImpl; +@override @useResult +$Res call({ + int length, List records +}); + + + + +} +/// @nodoc +class __$StockPickingResultCopyWithImpl<$Res> + implements _$StockPickingResultCopyWith<$Res> { + __$StockPickingResultCopyWithImpl(this._self, this._then); + + final _StockPickingResult _self; + final $Res Function(_StockPickingResult) _then; + +/// Create a copy of StockPickingResult +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? length = null,Object? records = null,}) { + return _then(_StockPickingResult( +length: null == length ? _self.length : length // ignore: cast_nullable_to_non_nullable +as int,records: null == records ? _self._records : records // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$StockPickingRecord { + + int get id;@JsonKey(name: 'company_id') IdOnly get companyId; String get priority; String get name;@JsonKey(name: 'partner_id') DisplayNameId get partnerId;@JsonKey(name: 'user_id') dynamic get userId;// peut être false ou null +@JsonKey(name: 'scheduled_date') String get scheduledDate;@JsonKey(name: 'picking_type_code') String get pickingTypeCode;@JsonKey(name: 'products_availability_state') dynamic get productsAvailabilityState;@JsonKey(name: 'products_availability') dynamic get productsAvailability;@JsonKey(name: 'date_deadline') String get dateDeadline;@JsonKey(name: 'date_done') dynamic get dateDone; String get origin;@JsonKey(name: 'backorder_id') dynamic get backorderId;@JsonKey(name: 'picking_type_id') DisplayNameId get pickingTypeId; String get state;@JsonKey(name: 'activity_exception_decoration') dynamic get activityExceptionDecoration;@JsonKey(name: 'activity_exception_icon') dynamic get activityExceptionIcon;@JsonKey(name: 'json_popover') dynamic get jsonPopover; +/// Create a copy of StockPickingRecord +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$StockPickingRecordCopyWith get copyWith => _$StockPickingRecordCopyWithImpl(this as StockPickingRecord, _$identity); + + /// Serializes this StockPickingRecord to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is StockPickingRecord&&(identical(other.id, id) || other.id == id)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.priority, priority) || other.priority == priority)&&(identical(other.name, name) || other.name == name)&&(identical(other.partnerId, partnerId) || other.partnerId == partnerId)&&const DeepCollectionEquality().equals(other.userId, userId)&&(identical(other.scheduledDate, scheduledDate) || other.scheduledDate == scheduledDate)&&(identical(other.pickingTypeCode, pickingTypeCode) || other.pickingTypeCode == pickingTypeCode)&&const DeepCollectionEquality().equals(other.productsAvailabilityState, productsAvailabilityState)&&const DeepCollectionEquality().equals(other.productsAvailability, productsAvailability)&&(identical(other.dateDeadline, dateDeadline) || other.dateDeadline == dateDeadline)&&const DeepCollectionEquality().equals(other.dateDone, dateDone)&&(identical(other.origin, origin) || other.origin == origin)&&const DeepCollectionEquality().equals(other.backorderId, backorderId)&&(identical(other.pickingTypeId, pickingTypeId) || other.pickingTypeId == pickingTypeId)&&(identical(other.state, state) || other.state == state)&&const DeepCollectionEquality().equals(other.activityExceptionDecoration, activityExceptionDecoration)&&const DeepCollectionEquality().equals(other.activityExceptionIcon, activityExceptionIcon)&&const DeepCollectionEquality().equals(other.jsonPopover, jsonPopover)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hashAll([runtimeType,id,companyId,priority,name,partnerId,const DeepCollectionEquality().hash(userId),scheduledDate,pickingTypeCode,const DeepCollectionEquality().hash(productsAvailabilityState),const DeepCollectionEquality().hash(productsAvailability),dateDeadline,const DeepCollectionEquality().hash(dateDone),origin,const DeepCollectionEquality().hash(backorderId),pickingTypeId,state,const DeepCollectionEquality().hash(activityExceptionDecoration),const DeepCollectionEquality().hash(activityExceptionIcon),const DeepCollectionEquality().hash(jsonPopover)]); + +@override +String toString() { + return 'StockPickingRecord(id: $id, companyId: $companyId, priority: $priority, name: $name, partnerId: $partnerId, userId: $userId, scheduledDate: $scheduledDate, pickingTypeCode: $pickingTypeCode, productsAvailabilityState: $productsAvailabilityState, productsAvailability: $productsAvailability, dateDeadline: $dateDeadline, dateDone: $dateDone, origin: $origin, backorderId: $backorderId, pickingTypeId: $pickingTypeId, state: $state, activityExceptionDecoration: $activityExceptionDecoration, activityExceptionIcon: $activityExceptionIcon, jsonPopover: $jsonPopover)'; +} + + +} + +/// @nodoc +abstract mixin class $StockPickingRecordCopyWith<$Res> { + factory $StockPickingRecordCopyWith(StockPickingRecord value, $Res Function(StockPickingRecord) _then) = _$StockPickingRecordCopyWithImpl; +@useResult +$Res call({ + int id,@JsonKey(name: 'company_id') IdOnly companyId, String priority, String name,@JsonKey(name: 'partner_id') DisplayNameId partnerId,@JsonKey(name: 'user_id') dynamic userId,@JsonKey(name: 'scheduled_date') String scheduledDate,@JsonKey(name: 'picking_type_code') String pickingTypeCode,@JsonKey(name: 'products_availability_state') dynamic productsAvailabilityState,@JsonKey(name: 'products_availability') dynamic productsAvailability,@JsonKey(name: 'date_deadline') String dateDeadline,@JsonKey(name: 'date_done') dynamic dateDone, String origin,@JsonKey(name: 'backorder_id') dynamic backorderId,@JsonKey(name: 'picking_type_id') DisplayNameId pickingTypeId, String state,@JsonKey(name: 'activity_exception_decoration') dynamic activityExceptionDecoration,@JsonKey(name: 'activity_exception_icon') dynamic activityExceptionIcon,@JsonKey(name: 'json_popover') dynamic jsonPopover +}); + + +$IdOnlyCopyWith<$Res> get companyId;$DisplayNameIdCopyWith<$Res> get partnerId;$DisplayNameIdCopyWith<$Res> get pickingTypeId; + +} +/// @nodoc +class _$StockPickingRecordCopyWithImpl<$Res> + implements $StockPickingRecordCopyWith<$Res> { + _$StockPickingRecordCopyWithImpl(this._self, this._then); + + final StockPickingRecord _self; + final $Res Function(StockPickingRecord) _then; + +/// Create a copy of StockPickingRecord +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? companyId = null,Object? priority = null,Object? name = null,Object? partnerId = null,Object? userId = freezed,Object? scheduledDate = null,Object? pickingTypeCode = null,Object? productsAvailabilityState = freezed,Object? productsAvailability = freezed,Object? dateDeadline = null,Object? dateDone = freezed,Object? origin = null,Object? backorderId = freezed,Object? pickingTypeId = null,Object? state = null,Object? activityExceptionDecoration = freezed,Object? activityExceptionIcon = freezed,Object? jsonPopover = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,companyId: null == companyId ? _self.companyId : companyId // ignore: cast_nullable_to_non_nullable +as IdOnly,priority: null == priority ? _self.priority : priority // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,partnerId: null == partnerId ? _self.partnerId : partnerId // ignore: cast_nullable_to_non_nullable +as DisplayNameId,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as dynamic,scheduledDate: null == scheduledDate ? _self.scheduledDate : scheduledDate // ignore: cast_nullable_to_non_nullable +as String,pickingTypeCode: null == pickingTypeCode ? _self.pickingTypeCode : pickingTypeCode // ignore: cast_nullable_to_non_nullable +as String,productsAvailabilityState: freezed == productsAvailabilityState ? _self.productsAvailabilityState : productsAvailabilityState // ignore: cast_nullable_to_non_nullable +as dynamic,productsAvailability: freezed == productsAvailability ? _self.productsAvailability : productsAvailability // ignore: cast_nullable_to_non_nullable +as dynamic,dateDeadline: null == dateDeadline ? _self.dateDeadline : dateDeadline // ignore: cast_nullable_to_non_nullable +as String,dateDone: freezed == dateDone ? _self.dateDone : dateDone // ignore: cast_nullable_to_non_nullable +as dynamic,origin: null == origin ? _self.origin : origin // ignore: cast_nullable_to_non_nullable +as String,backorderId: freezed == backorderId ? _self.backorderId : backorderId // ignore: cast_nullable_to_non_nullable +as dynamic,pickingTypeId: null == pickingTypeId ? _self.pickingTypeId : pickingTypeId // ignore: cast_nullable_to_non_nullable +as DisplayNameId,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String,activityExceptionDecoration: freezed == activityExceptionDecoration ? _self.activityExceptionDecoration : activityExceptionDecoration // ignore: cast_nullable_to_non_nullable +as dynamic,activityExceptionIcon: freezed == activityExceptionIcon ? _self.activityExceptionIcon : activityExceptionIcon // ignore: cast_nullable_to_non_nullable +as dynamic,jsonPopover: freezed == jsonPopover ? _self.jsonPopover : jsonPopover // ignore: cast_nullable_to_non_nullable +as dynamic, + )); +} +/// Create a copy of StockPickingRecord +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$IdOnlyCopyWith<$Res> get companyId { + + return $IdOnlyCopyWith<$Res>(_self.companyId, (value) { + return _then(_self.copyWith(companyId: value)); + }); +}/// Create a copy of StockPickingRecord +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DisplayNameIdCopyWith<$Res> get partnerId { + + return $DisplayNameIdCopyWith<$Res>(_self.partnerId, (value) { + return _then(_self.copyWith(partnerId: value)); + }); +}/// Create a copy of StockPickingRecord +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DisplayNameIdCopyWith<$Res> get pickingTypeId { + + return $DisplayNameIdCopyWith<$Res>(_self.pickingTypeId, (value) { + return _then(_self.copyWith(pickingTypeId: value)); + }); +} +} + + +/// @nodoc +@JsonSerializable() + +class _StockPickingRecord implements StockPickingRecord { + const _StockPickingRecord({required this.id, @JsonKey(name: 'company_id') required this.companyId, required this.priority, required this.name, @JsonKey(name: 'partner_id') required this.partnerId, @JsonKey(name: 'user_id') this.userId, @JsonKey(name: 'scheduled_date') required this.scheduledDate, @JsonKey(name: 'picking_type_code') required this.pickingTypeCode, @JsonKey(name: 'products_availability_state') this.productsAvailabilityState, @JsonKey(name: 'products_availability') this.productsAvailability, @JsonKey(name: 'date_deadline') required this.dateDeadline, @JsonKey(name: 'date_done') this.dateDone, required this.origin, @JsonKey(name: 'backorder_id') this.backorderId, @JsonKey(name: 'picking_type_id') required this.pickingTypeId, required this.state, @JsonKey(name: 'activity_exception_decoration') this.activityExceptionDecoration, @JsonKey(name: 'activity_exception_icon') this.activityExceptionIcon, @JsonKey(name: 'json_popover') this.jsonPopover}); + factory _StockPickingRecord.fromJson(Map json) => _$StockPickingRecordFromJson(json); + +@override final int id; +@override@JsonKey(name: 'company_id') final IdOnly companyId; +@override final String priority; +@override final String name; +@override@JsonKey(name: 'partner_id') final DisplayNameId partnerId; +@override@JsonKey(name: 'user_id') final dynamic userId; +// peut être false ou null +@override@JsonKey(name: 'scheduled_date') final String scheduledDate; +@override@JsonKey(name: 'picking_type_code') final String pickingTypeCode; +@override@JsonKey(name: 'products_availability_state') final dynamic productsAvailabilityState; +@override@JsonKey(name: 'products_availability') final dynamic productsAvailability; +@override@JsonKey(name: 'date_deadline') final String dateDeadline; +@override@JsonKey(name: 'date_done') final dynamic dateDone; +@override final String origin; +@override@JsonKey(name: 'backorder_id') final dynamic backorderId; +@override@JsonKey(name: 'picking_type_id') final DisplayNameId pickingTypeId; +@override final String state; +@override@JsonKey(name: 'activity_exception_decoration') final dynamic activityExceptionDecoration; +@override@JsonKey(name: 'activity_exception_icon') final dynamic activityExceptionIcon; +@override@JsonKey(name: 'json_popover') final dynamic jsonPopover; + +/// Create a copy of StockPickingRecord +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$StockPickingRecordCopyWith<_StockPickingRecord> get copyWith => __$StockPickingRecordCopyWithImpl<_StockPickingRecord>(this, _$identity); + +@override +Map toJson() { + return _$StockPickingRecordToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _StockPickingRecord&&(identical(other.id, id) || other.id == id)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.priority, priority) || other.priority == priority)&&(identical(other.name, name) || other.name == name)&&(identical(other.partnerId, partnerId) || other.partnerId == partnerId)&&const DeepCollectionEquality().equals(other.userId, userId)&&(identical(other.scheduledDate, scheduledDate) || other.scheduledDate == scheduledDate)&&(identical(other.pickingTypeCode, pickingTypeCode) || other.pickingTypeCode == pickingTypeCode)&&const DeepCollectionEquality().equals(other.productsAvailabilityState, productsAvailabilityState)&&const DeepCollectionEquality().equals(other.productsAvailability, productsAvailability)&&(identical(other.dateDeadline, dateDeadline) || other.dateDeadline == dateDeadline)&&const DeepCollectionEquality().equals(other.dateDone, dateDone)&&(identical(other.origin, origin) || other.origin == origin)&&const DeepCollectionEquality().equals(other.backorderId, backorderId)&&(identical(other.pickingTypeId, pickingTypeId) || other.pickingTypeId == pickingTypeId)&&(identical(other.state, state) || other.state == state)&&const DeepCollectionEquality().equals(other.activityExceptionDecoration, activityExceptionDecoration)&&const DeepCollectionEquality().equals(other.activityExceptionIcon, activityExceptionIcon)&&const DeepCollectionEquality().equals(other.jsonPopover, jsonPopover)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hashAll([runtimeType,id,companyId,priority,name,partnerId,const DeepCollectionEquality().hash(userId),scheduledDate,pickingTypeCode,const DeepCollectionEquality().hash(productsAvailabilityState),const DeepCollectionEquality().hash(productsAvailability),dateDeadline,const DeepCollectionEquality().hash(dateDone),origin,const DeepCollectionEquality().hash(backorderId),pickingTypeId,state,const DeepCollectionEquality().hash(activityExceptionDecoration),const DeepCollectionEquality().hash(activityExceptionIcon),const DeepCollectionEquality().hash(jsonPopover)]); + +@override +String toString() { + return 'StockPickingRecord(id: $id, companyId: $companyId, priority: $priority, name: $name, partnerId: $partnerId, userId: $userId, scheduledDate: $scheduledDate, pickingTypeCode: $pickingTypeCode, productsAvailabilityState: $productsAvailabilityState, productsAvailability: $productsAvailability, dateDeadline: $dateDeadline, dateDone: $dateDone, origin: $origin, backorderId: $backorderId, pickingTypeId: $pickingTypeId, state: $state, activityExceptionDecoration: $activityExceptionDecoration, activityExceptionIcon: $activityExceptionIcon, jsonPopover: $jsonPopover)'; +} + + +} + +/// @nodoc +abstract mixin class _$StockPickingRecordCopyWith<$Res> implements $StockPickingRecordCopyWith<$Res> { + factory _$StockPickingRecordCopyWith(_StockPickingRecord value, $Res Function(_StockPickingRecord) _then) = __$StockPickingRecordCopyWithImpl; +@override @useResult +$Res call({ + int id,@JsonKey(name: 'company_id') IdOnly companyId, String priority, String name,@JsonKey(name: 'partner_id') DisplayNameId partnerId,@JsonKey(name: 'user_id') dynamic userId,@JsonKey(name: 'scheduled_date') String scheduledDate,@JsonKey(name: 'picking_type_code') String pickingTypeCode,@JsonKey(name: 'products_availability_state') dynamic productsAvailabilityState,@JsonKey(name: 'products_availability') dynamic productsAvailability,@JsonKey(name: 'date_deadline') String dateDeadline,@JsonKey(name: 'date_done') dynamic dateDone, String origin,@JsonKey(name: 'backorder_id') dynamic backorderId,@JsonKey(name: 'picking_type_id') DisplayNameId pickingTypeId, String state,@JsonKey(name: 'activity_exception_decoration') dynamic activityExceptionDecoration,@JsonKey(name: 'activity_exception_icon') dynamic activityExceptionIcon,@JsonKey(name: 'json_popover') dynamic jsonPopover +}); + + +@override $IdOnlyCopyWith<$Res> get companyId;@override $DisplayNameIdCopyWith<$Res> get partnerId;@override $DisplayNameIdCopyWith<$Res> get pickingTypeId; + +} +/// @nodoc +class __$StockPickingRecordCopyWithImpl<$Res> + implements _$StockPickingRecordCopyWith<$Res> { + __$StockPickingRecordCopyWithImpl(this._self, this._then); + + final _StockPickingRecord _self; + final $Res Function(_StockPickingRecord) _then; + +/// Create a copy of StockPickingRecord +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? companyId = null,Object? priority = null,Object? name = null,Object? partnerId = null,Object? userId = freezed,Object? scheduledDate = null,Object? pickingTypeCode = null,Object? productsAvailabilityState = freezed,Object? productsAvailability = freezed,Object? dateDeadline = null,Object? dateDone = freezed,Object? origin = null,Object? backorderId = freezed,Object? pickingTypeId = null,Object? state = null,Object? activityExceptionDecoration = freezed,Object? activityExceptionIcon = freezed,Object? jsonPopover = freezed,}) { + return _then(_StockPickingRecord( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,companyId: null == companyId ? _self.companyId : companyId // ignore: cast_nullable_to_non_nullable +as IdOnly,priority: null == priority ? _self.priority : priority // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,partnerId: null == partnerId ? _self.partnerId : partnerId // ignore: cast_nullable_to_non_nullable +as DisplayNameId,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as dynamic,scheduledDate: null == scheduledDate ? _self.scheduledDate : scheduledDate // ignore: cast_nullable_to_non_nullable +as String,pickingTypeCode: null == pickingTypeCode ? _self.pickingTypeCode : pickingTypeCode // ignore: cast_nullable_to_non_nullable +as String,productsAvailabilityState: freezed == productsAvailabilityState ? _self.productsAvailabilityState : productsAvailabilityState // ignore: cast_nullable_to_non_nullable +as dynamic,productsAvailability: freezed == productsAvailability ? _self.productsAvailability : productsAvailability // ignore: cast_nullable_to_non_nullable +as dynamic,dateDeadline: null == dateDeadline ? _self.dateDeadline : dateDeadline // ignore: cast_nullable_to_non_nullable +as String,dateDone: freezed == dateDone ? _self.dateDone : dateDone // ignore: cast_nullable_to_non_nullable +as dynamic,origin: null == origin ? _self.origin : origin // ignore: cast_nullable_to_non_nullable +as String,backorderId: freezed == backorderId ? _self.backorderId : backorderId // ignore: cast_nullable_to_non_nullable +as dynamic,pickingTypeId: null == pickingTypeId ? _self.pickingTypeId : pickingTypeId // ignore: cast_nullable_to_non_nullable +as DisplayNameId,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String,activityExceptionDecoration: freezed == activityExceptionDecoration ? _self.activityExceptionDecoration : activityExceptionDecoration // ignore: cast_nullable_to_non_nullable +as dynamic,activityExceptionIcon: freezed == activityExceptionIcon ? _self.activityExceptionIcon : activityExceptionIcon // ignore: cast_nullable_to_non_nullable +as dynamic,jsonPopover: freezed == jsonPopover ? _self.jsonPopover : jsonPopover // ignore: cast_nullable_to_non_nullable +as dynamic, + )); +} + +/// Create a copy of StockPickingRecord +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$IdOnlyCopyWith<$Res> get companyId { + + return $IdOnlyCopyWith<$Res>(_self.companyId, (value) { + return _then(_self.copyWith(companyId: value)); + }); +}/// Create a copy of StockPickingRecord +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DisplayNameIdCopyWith<$Res> get partnerId { + + return $DisplayNameIdCopyWith<$Res>(_self.partnerId, (value) { + return _then(_self.copyWith(partnerId: value)); + }); +}/// Create a copy of StockPickingRecord +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DisplayNameIdCopyWith<$Res> get pickingTypeId { + + return $DisplayNameIdCopyWith<$Res>(_self.pickingTypeId, (value) { + return _then(_self.copyWith(pickingTypeId: value)); + }); +} +} + + +/// @nodoc +mixin _$IdOnly { + + int get id; +/// Create a copy of IdOnly +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$IdOnlyCopyWith get copyWith => _$IdOnlyCopyWithImpl(this as IdOnly, _$identity); + + /// Serializes this IdOnly to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is IdOnly&&(identical(other.id, id) || other.id == id)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id); + +@override +String toString() { + return 'IdOnly(id: $id)'; +} + + +} + +/// @nodoc +abstract mixin class $IdOnlyCopyWith<$Res> { + factory $IdOnlyCopyWith(IdOnly value, $Res Function(IdOnly) _then) = _$IdOnlyCopyWithImpl; +@useResult +$Res call({ + int id +}); + + + + +} +/// @nodoc +class _$IdOnlyCopyWithImpl<$Res> + implements $IdOnlyCopyWith<$Res> { + _$IdOnlyCopyWithImpl(this._self, this._then); + + final IdOnly _self; + final $Res Function(IdOnly) _then; + +/// Create a copy of IdOnly +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int, + )); +} + +} + + +/// @nodoc +@JsonSerializable() + +class _IdOnly implements IdOnly { + const _IdOnly({required this.id}); + factory _IdOnly.fromJson(Map json) => _$IdOnlyFromJson(json); + +@override final int id; + +/// Create a copy of IdOnly +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$IdOnlyCopyWith<_IdOnly> get copyWith => __$IdOnlyCopyWithImpl<_IdOnly>(this, _$identity); + +@override +Map toJson() { + return _$IdOnlyToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _IdOnly&&(identical(other.id, id) || other.id == id)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id); + +@override +String toString() { + return 'IdOnly(id: $id)'; +} + + +} + +/// @nodoc +abstract mixin class _$IdOnlyCopyWith<$Res> implements $IdOnlyCopyWith<$Res> { + factory _$IdOnlyCopyWith(_IdOnly value, $Res Function(_IdOnly) _then) = __$IdOnlyCopyWithImpl; +@override @useResult +$Res call({ + int id +}); + + + + +} +/// @nodoc +class __$IdOnlyCopyWithImpl<$Res> + implements _$IdOnlyCopyWith<$Res> { + __$IdOnlyCopyWithImpl(this._self, this._then); + + final _IdOnly _self; + final $Res Function(_IdOnly) _then; + +/// Create a copy of IdOnly +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,}) { + return _then(_IdOnly( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + + +/// @nodoc +mixin _$DisplayNameId { + + int get id;@JsonKey(name: 'display_name') String get displayName; +/// Create a copy of DisplayNameId +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DisplayNameIdCopyWith get copyWith => _$DisplayNameIdCopyWithImpl(this as DisplayNameId, _$identity); + + /// Serializes this DisplayNameId to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DisplayNameId&&(identical(other.id, id) || other.id == id)&&(identical(other.displayName, displayName) || other.displayName == displayName)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,displayName); + +@override +String toString() { + return 'DisplayNameId(id: $id, displayName: $displayName)'; +} + + +} + +/// @nodoc +abstract mixin class $DisplayNameIdCopyWith<$Res> { + factory $DisplayNameIdCopyWith(DisplayNameId value, $Res Function(DisplayNameId) _then) = _$DisplayNameIdCopyWithImpl; +@useResult +$Res call({ + int id,@JsonKey(name: 'display_name') String displayName +}); + + + + +} +/// @nodoc +class _$DisplayNameIdCopyWithImpl<$Res> + implements $DisplayNameIdCopyWith<$Res> { + _$DisplayNameIdCopyWithImpl(this._self, this._then); + + final DisplayNameId _self; + final $Res Function(DisplayNameId) _then; + +/// Create a copy of DisplayNameId +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? displayName = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,displayName: null == displayName ? _self.displayName : displayName // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// @nodoc +@JsonSerializable() + +class _DisplayNameId implements DisplayNameId { + const _DisplayNameId({required this.id, @JsonKey(name: 'display_name') required this.displayName}); + factory _DisplayNameId.fromJson(Map json) => _$DisplayNameIdFromJson(json); + +@override final int id; +@override@JsonKey(name: 'display_name') final String displayName; + +/// Create a copy of DisplayNameId +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DisplayNameIdCopyWith<_DisplayNameId> get copyWith => __$DisplayNameIdCopyWithImpl<_DisplayNameId>(this, _$identity); + +@override +Map toJson() { + return _$DisplayNameIdToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DisplayNameId&&(identical(other.id, id) || other.id == id)&&(identical(other.displayName, displayName) || other.displayName == displayName)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,displayName); + +@override +String toString() { + return 'DisplayNameId(id: $id, displayName: $displayName)'; +} + + +} + +/// @nodoc +abstract mixin class _$DisplayNameIdCopyWith<$Res> implements $DisplayNameIdCopyWith<$Res> { + factory _$DisplayNameIdCopyWith(_DisplayNameId value, $Res Function(_DisplayNameId) _then) = __$DisplayNameIdCopyWithImpl; +@override @useResult +$Res call({ + int id,@JsonKey(name: 'display_name') String displayName +}); + + + + +} +/// @nodoc +class __$DisplayNameIdCopyWithImpl<$Res> + implements _$DisplayNameIdCopyWith<$Res> { + __$DisplayNameIdCopyWithImpl(this._self, this._then); + + final _DisplayNameId _self; + final $Res Function(_DisplayNameId) _then; + +/// Create a copy of DisplayNameId +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? displayName = null,}) { + return _then(_DisplayNameId( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as int,displayName: null == displayName ? _self.displayName : displayName // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/lib/backend/schema/stock_picking/stock_picking_model.g.dart b/lib/backend/schema/stock_picking/stock_picking_model.g.dart new file mode 100644 index 0000000..039f9ff --- /dev/null +++ b/lib/backend/schema/stock_picking/stock_picking_model.g.dart @@ -0,0 +1,100 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stock_picking_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_StockPickingResponse _$StockPickingResponseFromJson( + Map json, +) => _StockPickingResponse( + jsonrpc: json['jsonrpc'] as String, + id: (json['id'] as num).toInt(), + result: StockPickingResult.fromJson(json['result'] as Map), +); + +Map _$StockPickingResponseToJson( + _StockPickingResponse instance, +) => { + 'jsonrpc': instance.jsonrpc, + 'id': instance.id, + 'result': instance.result, +}; + +_StockPickingResult _$StockPickingResultFromJson(Map json) => + _StockPickingResult( + length: (json['length'] as num).toInt(), + records: (json['records'] as List) + .map((e) => StockPickingRecord.fromJson(e as Map)) + .toList(), + ); + +Map _$StockPickingResultToJson(_StockPickingResult instance) => + {'length': instance.length, 'records': instance.records}; + +_StockPickingRecord _$StockPickingRecordFromJson(Map json) => + _StockPickingRecord( + id: (json['id'] as num).toInt(), + companyId: IdOnly.fromJson(json['company_id'] as Map), + priority: json['priority'] as String, + name: json['name'] as String, + partnerId: DisplayNameId.fromJson( + json['partner_id'] as Map, + ), + userId: json['user_id'], + scheduledDate: json['scheduled_date'] as String, + pickingTypeCode: json['picking_type_code'] as String, + productsAvailabilityState: json['products_availability_state'], + productsAvailability: json['products_availability'], + dateDeadline: json['date_deadline'] as String, + dateDone: json['date_done'], + origin: json['origin'] as String, + backorderId: json['backorder_id'], + pickingTypeId: DisplayNameId.fromJson( + json['picking_type_id'] as Map, + ), + state: json['state'] as String, + activityExceptionDecoration: json['activity_exception_decoration'], + activityExceptionIcon: json['activity_exception_icon'], + jsonPopover: json['json_popover'], + ); + +Map _$StockPickingRecordToJson(_StockPickingRecord instance) => + { + 'id': instance.id, + 'company_id': instance.companyId, + 'priority': instance.priority, + 'name': instance.name, + 'partner_id': instance.partnerId, + 'user_id': instance.userId, + 'scheduled_date': instance.scheduledDate, + 'picking_type_code': instance.pickingTypeCode, + 'products_availability_state': instance.productsAvailabilityState, + 'products_availability': instance.productsAvailability, + 'date_deadline': instance.dateDeadline, + 'date_done': instance.dateDone, + 'origin': instance.origin, + 'backorder_id': instance.backorderId, + 'picking_type_id': instance.pickingTypeId, + 'state': instance.state, + 'activity_exception_decoration': instance.activityExceptionDecoration, + 'activity_exception_icon': instance.activityExceptionIcon, + 'json_popover': instance.jsonPopover, + }; + +_IdOnly _$IdOnlyFromJson(Map json) => + _IdOnly(id: (json['id'] as num).toInt()); + +Map _$IdOnlyToJson(_IdOnly instance) => { + 'id': instance.id, +}; + +_DisplayNameId _$DisplayNameIdFromJson(Map json) => + _DisplayNameId( + id: (json['id'] as num).toInt(), + displayName: json['display_name'] as String, + ); + +Map _$DisplayNameIdToJson(_DisplayNameId instance) => + {'id': instance.id, 'display_name': instance.displayName}; diff --git a/lib/components/drawer_component.dart b/lib/components/drawer_component.dart index f6b6daf..cb90e1a 100644 --- a/lib/components/drawer_component.dart +++ b/lib/components/drawer_component.dart @@ -208,14 +208,13 @@ class SelectedDrawerState { class _ListTile extends StatelessWidget { const _ListTile({ - Key? key, required this.title, this.isActive = false, this.onTap, this.leadingIcon, this.contentPadding, this.trailing, - }) : super(key: key); + }); final bool isActive; final String title; final VoidCallback? onTap; diff --git a/lib/components/product_scanned_component.dart b/lib/components/product_scanned_component.dart index 3e8641c..3c5cae6 100644 --- a/lib/components/product_scanned_component.dart +++ b/lib/components/product_scanned_component.dart @@ -1,4 +1,4 @@ -import 'package:barcode_scanner/backend/schema/product/product_struct.dart'; +import 'package:barcode_scanner/backend/schema/product/product_model.dart'; import 'package:barcode_scanner/themes/app_theme.dart'; import 'package:flutter/material.dart'; @@ -9,7 +9,7 @@ class ProductScannedComponent extends StatefulWidget { this.onRescan, this.onDetails, }); - final ProductStruct productStruct; + final ProductModel productStruct; final Future Function()? onRescan; final Function()? onDetails; diff --git a/lib/pages/login/login_page_model.dart b/lib/pages/login/login_page_model.dart index 019cf07..9ad3c00 100644 --- a/lib/pages/login/login_page_model.dart +++ b/lib/pages/login/login_page_model.dart @@ -1,5 +1,5 @@ import 'package:barcode_scanner/backend/api/api_calls.dart'; -import 'package:barcode_scanner/backend/schema/auth/auth_struct.dart'; +import 'package:barcode_scanner/backend/schema/auth/auth_model.dart'; import 'package:barcode_scanner/backend/schema/user/user_struct.dart'; import 'package:barcode_scanner/services/secure_storage.dart'; import 'package:barcode_scanner/services/token_provider.dart'; @@ -87,7 +87,7 @@ class LoginPageModel extends StateNotifier { } } - Future setTokenInLocal(String token, AuthStruct auth) async { + Future setTokenInLocal(String token, AuthModel auth) async { await Future.wait([ tokenProvider.setToken(token), tokenProvider.setRefreshToken(token), diff --git a/lib/pages/scanner/scanner_page.dart b/lib/pages/scanner/scanner_page.dart index af05cd4..7fee447 100644 --- a/lib/pages/scanner/scanner_page.dart +++ b/lib/pages/scanner/scanner_page.dart @@ -3,7 +3,7 @@ import 'dart:async'; import 'package:barcode_scanner/backend/api/api_calls.dart'; import 'package:barcode_scanner/backend/objectbox/entities/product/product_entity.dart'; import 'package:barcode_scanner/backend/objectbox/objectbox_manager.dart'; -import 'package:barcode_scanner/backend/schema/product/product_struct.dart'; +import 'package:barcode_scanner/backend/schema/product/product_model.dart'; import 'package:barcode_scanner/components/loading_progress_component.dart'; import 'package:barcode_scanner/components/product_scanned_component.dart'; import 'package:barcode_scanner/router/go_secure_router_builder.dart'; @@ -108,7 +108,7 @@ class _ScannerPageState extends ConsumerState debugPrint('Nom du produit : ${product["product_name"]}'); debugPrint('Marque : ${product["brands"]}'); debugPrint('Image : ${product["image_url"]}'); - final productStruct = ProductStruct( + final productStruct = ProductModel( id: int.parse(product["id"]), image: product["image_thumb_url"], name: product["generic_name"], @@ -182,7 +182,7 @@ class _ScannerPageState extends ConsumerState debugPrint('Nom du produit : ${product["product_name"]}'); debugPrint('Marque : ${product["brands"]}'); debugPrint('Image : ${product["image_url"]}'); - final productStruct = ProductStruct( + final productStruct = ProductModel( id: int.parse(product["id"]), image: product["image_thumb_url"], name: product["generic_name"], diff --git a/lib/services/dio_service.dart b/lib/services/dio_service.dart index 807a530..baac0a4 100644 --- a/lib/services/dio_service.dart +++ b/lib/services/dio_service.dart @@ -18,7 +18,7 @@ class DioService { 'Content-Type': 'application/json', 'Accept': 'application/json, text/plain, */*', 'DNT': '1', - 'Referer': AppConstants.domain + 'Referer': AppConstants.domain, }, ); @@ -226,7 +226,7 @@ class DioService { return response; } - void _exception(error) { + void _exception(dynamic error) { if (error is DioException) { throw error; }