From d370c9474af80bc40c8a4bebe50d6d5d5a51c17b Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 2 Dec 2024 15:17:22 +0300 Subject: [PATCH] feat(profile): fix subs --- lib/features/profile/models/sub_model.dart | 3 +- .../profile/models/sub_model.freezed.dart | 46 ++++++++++--------- lib/features/profile/models/sub_model.g.dart | 4 +- .../presentation/widgets/sub_widget.dart | 2 +- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/lib/features/profile/models/sub_model.dart b/lib/features/profile/models/sub_model.dart index adce4bfb..4623e198 100644 --- a/lib/features/profile/models/sub_model.dart +++ b/lib/features/profile/models/sub_model.dart @@ -24,8 +24,7 @@ class SubModel with _$SubModel { required String name, required String city, required DateTime birthdate, - @JsonKey(name: 'is_subscribe') - required bool isSubscribe, + @JsonKey(name: 'is_entity_subscribed_by_me') required bool isEntitySubscribedByMe, required String email, @JsonKey(name: 'profile_photo_url') required String profilePhotoUrl, required String role, diff --git a/lib/features/profile/models/sub_model.freezed.dart b/lib/features/profile/models/sub_model.freezed.dart index b8938a71..5aeb0237 100644 --- a/lib/features/profile/models/sub_model.freezed.dart +++ b/lib/features/profile/models/sub_model.freezed.dart @@ -249,8 +249,8 @@ mixin _$SubModel { String get name => throw _privateConstructorUsedError; String get city => throw _privateConstructorUsedError; DateTime get birthdate => throw _privateConstructorUsedError; - @JsonKey(name: 'is_subscribe') - bool get isSubscribe => throw _privateConstructorUsedError; + @JsonKey(name: "is_entity_subscribed_by_me") + bool get isEntitySubscribedByMe => throw _privateConstructorUsedError; String get email => throw _privateConstructorUsedError; @JsonKey(name: 'profile_photo_url') String get profilePhotoUrl => throw _privateConstructorUsedError; @@ -283,7 +283,7 @@ abstract class $SubModelCopyWith<$Res> { String name, String city, DateTime birthdate, - @JsonKey(name: 'is_subscribe') bool isSubscribe, + @JsonKey(name: "is_entity_subscribed_by_me") bool isEntitySubscribedByMe, String email, @JsonKey(name: 'profile_photo_url') String profilePhotoUrl, String role, @@ -312,7 +312,7 @@ class _$SubModelCopyWithImpl<$Res, $Val extends SubModel> Object? name = null, Object? city = null, Object? birthdate = null, - Object? isSubscribe = null, + Object? isEntitySubscribedByMe = null, Object? email = null, Object? profilePhotoUrl = null, Object? role = null, @@ -341,9 +341,9 @@ class _$SubModelCopyWithImpl<$Res, $Val extends SubModel> ? _value.birthdate : birthdate // ignore: cast_nullable_to_non_nullable as DateTime, - isSubscribe: null == isSubscribe - ? _value.isSubscribe - : isSubscribe // ignore: cast_nullable_to_non_nullable + isEntitySubscribedByMe: null == isEntitySubscribedByMe + ? _value.isEntitySubscribedByMe + : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable as bool, email: null == email ? _value.email @@ -387,7 +387,7 @@ abstract class _$$SubModelImplCopyWith<$Res> String name, String city, DateTime birthdate, - @JsonKey(name: 'is_subscribe') bool isSubscribe, + @JsonKey(name: "is_entity_subscribed_by_me") bool isEntitySubscribedByMe, String email, @JsonKey(name: 'profile_photo_url') String profilePhotoUrl, String role, @@ -414,7 +414,7 @@ class __$$SubModelImplCopyWithImpl<$Res> Object? name = null, Object? city = null, Object? birthdate = null, - Object? isSubscribe = null, + Object? isEntitySubscribedByMe = null, Object? email = null, Object? profilePhotoUrl = null, Object? role = null, @@ -443,9 +443,9 @@ class __$$SubModelImplCopyWithImpl<$Res> ? _value.birthdate : birthdate // ignore: cast_nullable_to_non_nullable as DateTime, - isSubscribe: null == isSubscribe - ? _value.isSubscribe - : isSubscribe // ignore: cast_nullable_to_non_nullable + isEntitySubscribedByMe: null == isEntitySubscribedByMe + ? _value.isEntitySubscribedByMe + : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable as bool, email: null == email ? _value.email @@ -484,7 +484,8 @@ class _$SubModelImpl implements _SubModel { required this.name, required this.city, required this.birthdate, - @JsonKey(name: 'is_subscribe') required this.isSubscribe, + @JsonKey(name: "is_entity_subscribed_by_me") + required this.isEntitySubscribedByMe, required this.email, @JsonKey(name: 'profile_photo_url') required this.profilePhotoUrl, required this.role, @@ -506,8 +507,8 @@ class _$SubModelImpl implements _SubModel { @override final DateTime birthdate; @override - @JsonKey(name: 'is_subscribe') - final bool isSubscribe; + @JsonKey(name: "is_entity_subscribed_by_me") + final bool isEntitySubscribedByMe; @override final String email; @override @@ -527,7 +528,7 @@ class _$SubModelImpl implements _SubModel { @override String toString() { - return 'SubModel(id: $id, slug: $slug, name: $name, city: $city, birthdate: $birthdate, isSubscribe: $isSubscribe, email: $email, profilePhotoUrl: $profilePhotoUrl, role: $role, isPublicProfile: $isPublicProfile, createdAt: $createdAt, updatedAt: $updatedAt)'; + return 'SubModel(id: $id, slug: $slug, name: $name, city: $city, birthdate: $birthdate, isEntitySubscribedByMe: $isEntitySubscribedByMe, email: $email, profilePhotoUrl: $profilePhotoUrl, role: $role, isPublicProfile: $isPublicProfile, createdAt: $createdAt, updatedAt: $updatedAt)'; } @override @@ -541,8 +542,8 @@ class _$SubModelImpl implements _SubModel { (identical(other.city, city) || other.city == city) && (identical(other.birthdate, birthdate) || other.birthdate == birthdate) && - (identical(other.isSubscribe, isSubscribe) || - other.isSubscribe == isSubscribe) && + (identical(other.isEntitySubscribedByMe, isEntitySubscribedByMe) || + other.isEntitySubscribedByMe == isEntitySubscribedByMe) && (identical(other.email, email) || other.email == email) && (identical(other.profilePhotoUrl, profilePhotoUrl) || other.profilePhotoUrl == profilePhotoUrl) && @@ -564,7 +565,7 @@ class _$SubModelImpl implements _SubModel { name, city, birthdate, - isSubscribe, + isEntitySubscribedByMe, email, profilePhotoUrl, role, @@ -595,7 +596,8 @@ abstract class _SubModel implements SubModel { required final String name, required final String city, required final DateTime birthdate, - @JsonKey(name: 'is_subscribe') required final bool isSubscribe, + @JsonKey(name: "is_entity_subscribed_by_me") + required final bool isEntitySubscribedByMe, required final String email, @JsonKey(name: 'profile_photo_url') required final String profilePhotoUrl, required final String role, @@ -618,8 +620,8 @@ abstract class _SubModel implements SubModel { @override DateTime get birthdate; @override - @JsonKey(name: 'is_subscribe') - bool get isSubscribe; + @JsonKey(name: "is_entity_subscribed_by_me") + bool get isEntitySubscribedByMe; @override String get email; @override diff --git a/lib/features/profile/models/sub_model.g.dart b/lib/features/profile/models/sub_model.g.dart index a6536132..e3c9397e 100644 --- a/lib/features/profile/models/sub_model.g.dart +++ b/lib/features/profile/models/sub_model.g.dart @@ -31,7 +31,7 @@ _$SubModelImpl _$$SubModelImplFromJson(Map json) => name: json['name'] as String, city: json['city'] as String, birthdate: DateTime.parse(json['birthdate'] as String), - isSubscribe: json['is_subscribe'] as bool, + isEntitySubscribedByMe: json['is_entity_subscribed_by_me'] as bool, email: json['email'] as String, profilePhotoUrl: json['profile_photo_url'] as String, role: json['role'] as String, @@ -47,7 +47,7 @@ Map _$$SubModelImplToJson(_$SubModelImpl instance) => 'name': instance.name, 'city': instance.city, 'birthdate': instance.birthdate.toIso8601String(), - 'is_subscribe': instance.isSubscribe, + 'is_entity_subscribed_by_me': instance.isEntitySubscribedByMe, 'email': instance.email, 'profile_photo_url': instance.profilePhotoUrl, 'role': instance.role, diff --git a/lib/features/profile/presentation/widgets/sub_widget.dart b/lib/features/profile/presentation/widgets/sub_widget.dart index 0a4e2d40..ad42573f 100644 --- a/lib/features/profile/presentation/widgets/sub_widget.dart +++ b/lib/features/profile/presentation/widgets/sub_widget.dart @@ -66,7 +66,7 @@ class _SubWidgetState extends State { ), const Spacer(), SubActionButtonWidget( - subActionType: widget.subModel.isSubscribe ? SubActionType.SendMessage : SubActionType.Subscribe, + subActionType: widget.subModel.isEntitySubscribedByMe ? SubActionType.SendMessage : SubActionType.Subscribe, slug: widget.subModel.slug, ), ],