From 880ef4c17529e25098908cbeb57df9fc088c3236 Mon Sep 17 00:00:00 2001 From: MrM Date: Tue, 3 Jun 2025 22:52:33 +0330 Subject: [PATCH] feat : auth for new module --- .../user_info/user_info_model.freezed.dart | 157 ++++++++++++++ .../response/user_info/user_info_model.g.dart | 23 ++ .../user_profile_model.freezed.dart | 201 ++++++++++++++++++ .../user_profile_model.g.dart | 47 ++++ 4 files changed, 428 insertions(+) create mode 100644 packages/auth/lib/data/models/response/user_info/user_info_model.freezed.dart create mode 100644 packages/auth/lib/data/models/response/user_info/user_info_model.g.dart create mode 100644 packages/auth/lib/data/models/response/user_profile_model/user_profile_model.freezed.dart create mode 100644 packages/auth/lib/data/models/response/user_profile_model/user_profile_model.g.dart diff --git a/packages/auth/lib/data/models/response/user_info/user_info_model.freezed.dart b/packages/auth/lib/data/models/response/user_info/user_info_model.freezed.dart new file mode 100644 index 0000000..bbb225d --- /dev/null +++ b/packages/auth/lib/data/models/response/user_info/user_info_model.freezed.dart @@ -0,0 +1,157 @@ +// 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 'user_info_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserInfoModel { + + bool? get isUser; String? get address; String? get backend; String? get apiKey; +/// Create a copy of UserInfoModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UserInfoModelCopyWith get copyWith => _$UserInfoModelCopyWithImpl(this as UserInfoModel, _$identity); + + /// Serializes this UserInfoModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UserInfoModel&&(identical(other.isUser, isUser) || other.isUser == isUser)&&(identical(other.address, address) || other.address == address)&&(identical(other.backend, backend) || other.backend == backend)&&(identical(other.apiKey, apiKey) || other.apiKey == apiKey)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,isUser,address,backend,apiKey); + +@override +String toString() { + return 'UserInfoModel(isUser: $isUser, address: $address, backend: $backend, apiKey: $apiKey)'; +} + + +} + +/// @nodoc +abstract mixin class $UserInfoModelCopyWith<$Res> { + factory $UserInfoModelCopyWith(UserInfoModel value, $Res Function(UserInfoModel) _then) = _$UserInfoModelCopyWithImpl; +@useResult +$Res call({ + bool? isUser, String? address, String? backend, String? apiKey +}); + + + + +} +/// @nodoc +class _$UserInfoModelCopyWithImpl<$Res> + implements $UserInfoModelCopyWith<$Res> { + _$UserInfoModelCopyWithImpl(this._self, this._then); + + final UserInfoModel _self; + final $Res Function(UserInfoModel) _then; + +/// Create a copy of UserInfoModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isUser = freezed,Object? address = freezed,Object? backend = freezed,Object? apiKey = freezed,}) { + return _then(_self.copyWith( +isUser: freezed == isUser ? _self.isUser : isUser // ignore: cast_nullable_to_non_nullable +as bool?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as String?,backend: freezed == backend ? _self.backend : backend // ignore: cast_nullable_to_non_nullable +as String?,apiKey: freezed == apiKey ? _self.apiKey : apiKey // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// @nodoc +@JsonSerializable() + +class _UserInfoModel implements UserInfoModel { + const _UserInfoModel({this.isUser, this.address, this.backend, this.apiKey}); + factory _UserInfoModel.fromJson(Map json) => _$UserInfoModelFromJson(json); + +@override final bool? isUser; +@override final String? address; +@override final String? backend; +@override final String? apiKey; + +/// Create a copy of UserInfoModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$UserInfoModelCopyWith<_UserInfoModel> get copyWith => __$UserInfoModelCopyWithImpl<_UserInfoModel>(this, _$identity); + +@override +Map toJson() { + return _$UserInfoModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserInfoModel&&(identical(other.isUser, isUser) || other.isUser == isUser)&&(identical(other.address, address) || other.address == address)&&(identical(other.backend, backend) || other.backend == backend)&&(identical(other.apiKey, apiKey) || other.apiKey == apiKey)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,isUser,address,backend,apiKey); + +@override +String toString() { + return 'UserInfoModel(isUser: $isUser, address: $address, backend: $backend, apiKey: $apiKey)'; +} + + +} + +/// @nodoc +abstract mixin class _$UserInfoModelCopyWith<$Res> implements $UserInfoModelCopyWith<$Res> { + factory _$UserInfoModelCopyWith(_UserInfoModel value, $Res Function(_UserInfoModel) _then) = __$UserInfoModelCopyWithImpl; +@override @useResult +$Res call({ + bool? isUser, String? address, String? backend, String? apiKey +}); + + + + +} +/// @nodoc +class __$UserInfoModelCopyWithImpl<$Res> + implements _$UserInfoModelCopyWith<$Res> { + __$UserInfoModelCopyWithImpl(this._self, this._then); + + final _UserInfoModel _self; + final $Res Function(_UserInfoModel) _then; + +/// Create a copy of UserInfoModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isUser = freezed,Object? address = freezed,Object? backend = freezed,Object? apiKey = freezed,}) { + return _then(_UserInfoModel( +isUser: freezed == isUser ? _self.isUser : isUser // ignore: cast_nullable_to_non_nullable +as bool?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as String?,backend: freezed == backend ? _self.backend : backend // ignore: cast_nullable_to_non_nullable +as String?,apiKey: freezed == apiKey ? _self.apiKey : apiKey // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/packages/auth/lib/data/models/response/user_info/user_info_model.g.dart b/packages/auth/lib/data/models/response/user_info/user_info_model.g.dart new file mode 100644 index 0000000..2c8f1c4 --- /dev/null +++ b/packages/auth/lib/data/models/response/user_info/user_info_model.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_info_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UserInfoModel _$UserInfoModelFromJson(Map json) => + _UserInfoModel( + isUser: json['is_user'] as bool?, + address: json['address'] as String?, + backend: json['backend'] as String?, + apiKey: json['api_key'] as String?, + ); + +Map _$UserInfoModelToJson(_UserInfoModel instance) => + { + 'is_user': instance.isUser, + 'address': instance.address, + 'backend': instance.backend, + 'api_key': instance.apiKey, + }; diff --git a/packages/auth/lib/data/models/response/user_profile_model/user_profile_model.freezed.dart b/packages/auth/lib/data/models/response/user_profile_model/user_profile_model.freezed.dart new file mode 100644 index 0000000..0f5e570 --- /dev/null +++ b/packages/auth/lib/data/models/response/user_profile_model/user_profile_model.freezed.dart @@ -0,0 +1,201 @@ +// 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 'user_profile_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserProfileModel { + + String? get accessToken; String? get expiresIn; String? get scope; String? get expireTime; String? get mobile; String? get fullname; String? get firstname; String? get lastname; String? get city; String? get province; String? get nationalCode; String? get nationalId; String? get birthday; String? get image; int? get baseOrder; List? get role; +/// Create a copy of UserProfileModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UserProfileModelCopyWith get copyWith => _$UserProfileModelCopyWithImpl(this as UserProfileModel, _$identity); + + /// Serializes this UserProfileModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UserProfileModel&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.expiresIn, expiresIn) || other.expiresIn == expiresIn)&&(identical(other.scope, scope) || other.scope == scope)&&(identical(other.expireTime, expireTime) || other.expireTime == expireTime)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstname, firstname) || other.firstname == firstname)&&(identical(other.lastname, lastname) || other.lastname == lastname)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.nationalCode, nationalCode) || other.nationalCode == nationalCode)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.birthday, birthday) || other.birthday == birthday)&&(identical(other.image, image) || other.image == image)&&(identical(other.baseOrder, baseOrder) || other.baseOrder == baseOrder)&&const DeepCollectionEquality().equals(other.role, role)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,accessToken,expiresIn,scope,expireTime,mobile,fullname,firstname,lastname,city,province,nationalCode,nationalId,birthday,image,baseOrder,const DeepCollectionEquality().hash(role)); + +@override +String toString() { + return 'UserProfileModel(accessToken: $accessToken, expiresIn: $expiresIn, scope: $scope, expireTime: $expireTime, mobile: $mobile, fullname: $fullname, firstname: $firstname, lastname: $lastname, city: $city, province: $province, nationalCode: $nationalCode, nationalId: $nationalId, birthday: $birthday, image: $image, baseOrder: $baseOrder, role: $role)'; +} + + +} + +/// @nodoc +abstract mixin class $UserProfileModelCopyWith<$Res> { + factory $UserProfileModelCopyWith(UserProfileModel value, $Res Function(UserProfileModel) _then) = _$UserProfileModelCopyWithImpl; +@useResult +$Res call({ + String? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List? role +}); + + + + +} +/// @nodoc +class _$UserProfileModelCopyWithImpl<$Res> + implements $UserProfileModelCopyWith<$Res> { + _$UserProfileModelCopyWithImpl(this._self, this._then); + + final UserProfileModel _self; + final $Res Function(UserProfileModel) _then; + +/// Create a copy of UserProfileModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? accessToken = freezed,Object? expiresIn = freezed,Object? scope = freezed,Object? expireTime = freezed,Object? mobile = freezed,Object? fullname = freezed,Object? firstname = freezed,Object? lastname = freezed,Object? city = freezed,Object? province = freezed,Object? nationalCode = freezed,Object? nationalId = freezed,Object? birthday = freezed,Object? image = freezed,Object? baseOrder = freezed,Object? role = freezed,}) { + return _then(_self.copyWith( +accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable +as String?,expiresIn: freezed == expiresIn ? _self.expiresIn : expiresIn // ignore: cast_nullable_to_non_nullable +as String?,scope: freezed == scope ? _self.scope : scope // ignore: cast_nullable_to_non_nullable +as String?,expireTime: freezed == expireTime ? _self.expireTime : expireTime // ignore: cast_nullable_to_non_nullable +as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable +as String?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable +as String?,firstname: freezed == firstname ? _self.firstname : firstname // ignore: cast_nullable_to_non_nullable +as String?,lastname: freezed == lastname ? _self.lastname : lastname // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable +as String?,nationalCode: freezed == nationalCode ? _self.nationalCode : nationalCode // ignore: cast_nullable_to_non_nullable +as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable +as String?,birthday: freezed == birthday ? _self.birthday : birthday // ignore: cast_nullable_to_non_nullable +as String?,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?,baseOrder: freezed == baseOrder ? _self.baseOrder : baseOrder // ignore: cast_nullable_to_non_nullable +as int?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as List?, + )); +} + +} + + +/// @nodoc +@JsonSerializable() + +class _UserProfileModel implements UserProfileModel { + const _UserProfileModel({this.accessToken, this.expiresIn, this.scope, this.expireTime, this.mobile, this.fullname, this.firstname, this.lastname, this.city, this.province, this.nationalCode, this.nationalId, this.birthday, this.image, this.baseOrder, final List? role}): _role = role; + factory _UserProfileModel.fromJson(Map json) => _$UserProfileModelFromJson(json); + +@override final String? accessToken; +@override final String? expiresIn; +@override final String? scope; +@override final String? expireTime; +@override final String? mobile; +@override final String? fullname; +@override final String? firstname; +@override final String? lastname; +@override final String? city; +@override final String? province; +@override final String? nationalCode; +@override final String? nationalId; +@override final String? birthday; +@override final String? image; +@override final int? baseOrder; + final List? _role; +@override List? get role { + final value = _role; + if (value == null) return null; + if (_role is EqualUnmodifiableListView) return _role; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); +} + + +/// Create a copy of UserProfileModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$UserProfileModelCopyWith<_UserProfileModel> get copyWith => __$UserProfileModelCopyWithImpl<_UserProfileModel>(this, _$identity); + +@override +Map toJson() { + return _$UserProfileModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserProfileModel&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.expiresIn, expiresIn) || other.expiresIn == expiresIn)&&(identical(other.scope, scope) || other.scope == scope)&&(identical(other.expireTime, expireTime) || other.expireTime == expireTime)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstname, firstname) || other.firstname == firstname)&&(identical(other.lastname, lastname) || other.lastname == lastname)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.nationalCode, nationalCode) || other.nationalCode == nationalCode)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.birthday, birthday) || other.birthday == birthday)&&(identical(other.image, image) || other.image == image)&&(identical(other.baseOrder, baseOrder) || other.baseOrder == baseOrder)&&const DeepCollectionEquality().equals(other._role, _role)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,accessToken,expiresIn,scope,expireTime,mobile,fullname,firstname,lastname,city,province,nationalCode,nationalId,birthday,image,baseOrder,const DeepCollectionEquality().hash(_role)); + +@override +String toString() { + return 'UserProfileModel(accessToken: $accessToken, expiresIn: $expiresIn, scope: $scope, expireTime: $expireTime, mobile: $mobile, fullname: $fullname, firstname: $firstname, lastname: $lastname, city: $city, province: $province, nationalCode: $nationalCode, nationalId: $nationalId, birthday: $birthday, image: $image, baseOrder: $baseOrder, role: $role)'; +} + + +} + +/// @nodoc +abstract mixin class _$UserProfileModelCopyWith<$Res> implements $UserProfileModelCopyWith<$Res> { + factory _$UserProfileModelCopyWith(_UserProfileModel value, $Res Function(_UserProfileModel) _then) = __$UserProfileModelCopyWithImpl; +@override @useResult +$Res call({ + String? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List? role +}); + + + + +} +/// @nodoc +class __$UserProfileModelCopyWithImpl<$Res> + implements _$UserProfileModelCopyWith<$Res> { + __$UserProfileModelCopyWithImpl(this._self, this._then); + + final _UserProfileModel _self; + final $Res Function(_UserProfileModel) _then; + +/// Create a copy of UserProfileModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? accessToken = freezed,Object? expiresIn = freezed,Object? scope = freezed,Object? expireTime = freezed,Object? mobile = freezed,Object? fullname = freezed,Object? firstname = freezed,Object? lastname = freezed,Object? city = freezed,Object? province = freezed,Object? nationalCode = freezed,Object? nationalId = freezed,Object? birthday = freezed,Object? image = freezed,Object? baseOrder = freezed,Object? role = freezed,}) { + return _then(_UserProfileModel( +accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable +as String?,expiresIn: freezed == expiresIn ? _self.expiresIn : expiresIn // ignore: cast_nullable_to_non_nullable +as String?,scope: freezed == scope ? _self.scope : scope // ignore: cast_nullable_to_non_nullable +as String?,expireTime: freezed == expireTime ? _self.expireTime : expireTime // ignore: cast_nullable_to_non_nullable +as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable +as String?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable +as String?,firstname: freezed == firstname ? _self.firstname : firstname // ignore: cast_nullable_to_non_nullable +as String?,lastname: freezed == lastname ? _self.lastname : lastname // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable +as String?,nationalCode: freezed == nationalCode ? _self.nationalCode : nationalCode // ignore: cast_nullable_to_non_nullable +as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable +as String?,birthday: freezed == birthday ? _self.birthday : birthday // ignore: cast_nullable_to_non_nullable +as String?,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?,baseOrder: freezed == baseOrder ? _self.baseOrder : baseOrder // ignore: cast_nullable_to_non_nullable +as int?,role: freezed == role ? _self._role : role // ignore: cast_nullable_to_non_nullable +as List?, + )); +} + + +} + +// dart format on diff --git a/packages/auth/lib/data/models/response/user_profile_model/user_profile_model.g.dart b/packages/auth/lib/data/models/response/user_profile_model/user_profile_model.g.dart new file mode 100644 index 0000000..df72e0e --- /dev/null +++ b/packages/auth/lib/data/models/response/user_profile_model/user_profile_model.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_profile_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UserProfileModel _$UserProfileModelFromJson(Map json) => + _UserProfileModel( + accessToken: json['access_token'] as String?, + expiresIn: json['expires_in'] as String?, + scope: json['scope'] as String?, + expireTime: json['expire_time'] as String?, + mobile: json['mobile'] as String?, + fullname: json['fullname'] as String?, + firstname: json['firstname'] as String?, + lastname: json['lastname'] as String?, + city: json['city'] as String?, + province: json['province'] as String?, + nationalCode: json['national_code'] as String?, + nationalId: json['national_id'] as String?, + birthday: json['birthday'] as String?, + image: json['image'] as String?, + baseOrder: (json['base_order'] as num?)?.toInt(), + role: (json['role'] as List?)?.map((e) => e as String).toList(), + ); + +Map _$UserProfileModelToJson(_UserProfileModel instance) => + { + 'access_token': instance.accessToken, + 'expires_in': instance.expiresIn, + 'scope': instance.scope, + 'expire_time': instance.expireTime, + 'mobile': instance.mobile, + 'fullname': instance.fullname, + 'firstname': instance.firstname, + 'lastname': instance.lastname, + 'city': instance.city, + 'province': instance.province, + 'national_code': instance.nationalCode, + 'national_id': instance.nationalId, + 'birthday': instance.birthday, + 'image': instance.image, + 'base_order': instance.baseOrder, + 'role': instance.role, + };