feat(profile): add subscribers and subscriptions

This commit is contained in:
mso7nueh
2024-10-16 15:52:23 +03:00
parent b0f8057aa0
commit 079a712997
11 changed files with 1046 additions and 267 deletions

View File

@@ -38,7 +38,16 @@ mixin _$ProfileModel {
String get slug => throw _privateConstructorUsedError;
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl => throw _privateConstructorUsedError;
@JsonKey(name: "role")
String get role => throw _privateConstructorUsedError;
@JsonKey(name: "badges")
List<BadgeModel> get badges => throw _privateConstructorUsedError;
@JsonKey(name: "subscriptions")
List<ProfilePreviewModel> get subscriptions =>
throw _privateConstructorUsedError;
@JsonKey(name: "subscribers")
List<ProfilePreviewModel> get subscribers =>
throw _privateConstructorUsedError;
/// Serializes this ProfileModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -66,7 +75,10 @@ abstract class $ProfileModelCopyWith<$Res> {
@JsonKey(name: "is_public_profile") bool isPublicProfile,
@JsonKey(name: "slug") String slug,
@JsonKey(name: "profile_photo_url") String profilePhotoUrl,
String role});
@JsonKey(name: "role") String role,
@JsonKey(name: "badges") List<BadgeModel> badges,
@JsonKey(name: "subscriptions") List<ProfilePreviewModel> subscriptions,
@JsonKey(name: "subscribers") List<ProfilePreviewModel> subscribers});
}
/// @nodoc
@@ -94,6 +106,9 @@ class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel>
Object? slug = null,
Object? profilePhotoUrl = null,
Object? role = null,
Object? badges = null,
Object? subscriptions = null,
Object? subscribers = null,
}) {
return _then(_value.copyWith(
id: null == id
@@ -136,6 +151,18 @@ class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel>
? _value.role
: role // ignore: cast_nullable_to_non_nullable
as String,
badges: null == badges
? _value.badges
: badges // ignore: cast_nullable_to_non_nullable
as List<BadgeModel>,
subscriptions: null == subscriptions
? _value.subscriptions
: subscriptions // ignore: cast_nullable_to_non_nullable
as List<ProfilePreviewModel>,
subscribers: null == subscribers
? _value.subscribers
: subscribers // ignore: cast_nullable_to_non_nullable
as List<ProfilePreviewModel>,
) as $Val);
}
}
@@ -158,7 +185,10 @@ abstract class _$$ProfileModelImplCopyWith<$Res>
@JsonKey(name: "is_public_profile") bool isPublicProfile,
@JsonKey(name: "slug") String slug,
@JsonKey(name: "profile_photo_url") String profilePhotoUrl,
String role});
@JsonKey(name: "role") String role,
@JsonKey(name: "badges") List<BadgeModel> badges,
@JsonKey(name: "subscriptions") List<ProfilePreviewModel> subscriptions,
@JsonKey(name: "subscribers") List<ProfilePreviewModel> subscribers});
}
/// @nodoc
@@ -184,6 +214,9 @@ class __$$ProfileModelImplCopyWithImpl<$Res>
Object? slug = null,
Object? profilePhotoUrl = null,
Object? role = null,
Object? badges = null,
Object? subscriptions = null,
Object? subscribers = null,
}) {
return _then(_$ProfileModelImpl(
id: null == id
@@ -226,6 +259,18 @@ class __$$ProfileModelImplCopyWithImpl<$Res>
? _value.role
: role // ignore: cast_nullable_to_non_nullable
as String,
badges: null == badges
? _value._badges
: badges // ignore: cast_nullable_to_non_nullable
as List<BadgeModel>,
subscriptions: null == subscriptions
? _value._subscriptions
: subscriptions // ignore: cast_nullable_to_non_nullable
as List<ProfilePreviewModel>,
subscribers: null == subscribers
? _value._subscribers
: subscribers // ignore: cast_nullable_to_non_nullable
as List<ProfilePreviewModel>,
));
}
}
@@ -243,7 +288,15 @@ class _$ProfileModelImpl implements _ProfileModel {
@JsonKey(name: "is_public_profile") required this.isPublicProfile,
@JsonKey(name: "slug") required this.slug,
@JsonKey(name: "profile_photo_url") required this.profilePhotoUrl,
required this.role});
@JsonKey(name: "role") required this.role,
@JsonKey(name: "badges") required final List<BadgeModel> badges,
@JsonKey(name: "subscriptions")
required final List<ProfilePreviewModel> subscriptions,
@JsonKey(name: "subscribers")
required final List<ProfilePreviewModel> subscribers})
: _badges = badges,
_subscriptions = subscriptions,
_subscribers = subscribers;
factory _$ProfileModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ProfileModelImplFromJson(json);
@@ -276,11 +329,38 @@ class _$ProfileModelImpl implements _ProfileModel {
@JsonKey(name: "profile_photo_url")
final String profilePhotoUrl;
@override
@JsonKey(name: "role")
final String role;
final List<BadgeModel> _badges;
@override
@JsonKey(name: "badges")
List<BadgeModel> get badges {
if (_badges is EqualUnmodifiableListView) return _badges;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_badges);
}
final List<ProfilePreviewModel> _subscriptions;
@override
@JsonKey(name: "subscriptions")
List<ProfilePreviewModel> get subscriptions {
if (_subscriptions is EqualUnmodifiableListView) return _subscriptions;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_subscriptions);
}
final List<ProfilePreviewModel> _subscribers;
@override
@JsonKey(name: "subscribers")
List<ProfilePreviewModel> get subscribers {
if (_subscribers is EqualUnmodifiableListView) return _subscribers;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_subscribers);
}
@override
String toString() {
return 'ProfileModel(id: $id, name: $name, email: $email, emailVerifiedAt: $emailVerifiedAt, createdAt: $createdAt, updatedAt: $updatedAt, isPublicProfile: $isPublicProfile, slug: $slug, profilePhotoUrl: $profilePhotoUrl, role: $role)';
return 'ProfileModel(id: $id, name: $name, email: $email, emailVerifiedAt: $emailVerifiedAt, createdAt: $createdAt, updatedAt: $updatedAt, isPublicProfile: $isPublicProfile, slug: $slug, profilePhotoUrl: $profilePhotoUrl, role: $role, badges: $badges, subscriptions: $subscriptions, subscribers: $subscribers)';
}
@override
@@ -302,13 +382,31 @@ class _$ProfileModelImpl implements _ProfileModel {
(identical(other.slug, slug) || other.slug == slug) &&
(identical(other.profilePhotoUrl, profilePhotoUrl) ||
other.profilePhotoUrl == profilePhotoUrl) &&
(identical(other.role, role) || other.role == role));
(identical(other.role, role) || other.role == role) &&
const DeepCollectionEquality().equals(other._badges, _badges) &&
const DeepCollectionEquality()
.equals(other._subscriptions, _subscriptions) &&
const DeepCollectionEquality()
.equals(other._subscribers, _subscribers));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, name, email, emailVerifiedAt,
createdAt, updatedAt, isPublicProfile, slug, profilePhotoUrl, role);
int get hashCode => Object.hash(
runtimeType,
id,
name,
email,
emailVerifiedAt,
createdAt,
updatedAt,
isPublicProfile,
slug,
profilePhotoUrl,
role,
const DeepCollectionEquality().hash(_badges),
const DeepCollectionEquality().hash(_subscriptions),
const DeepCollectionEquality().hash(_subscribers));
/// Create a copy of ProfileModel
/// with the given fields replaced by the non-null parameter values.
@@ -337,7 +435,13 @@ abstract class _ProfileModel implements ProfileModel {
@JsonKey(name: "is_public_profile") required final bool isPublicProfile,
@JsonKey(name: "slug") required final String slug,
@JsonKey(name: "profile_photo_url") required final String profilePhotoUrl,
required final String role}) = _$ProfileModelImpl;
@JsonKey(name: "role") required final String role,
@JsonKey(name: "badges") required final List<BadgeModel> badges,
@JsonKey(name: "subscriptions")
required final List<ProfilePreviewModel> subscriptions,
@JsonKey(name: "subscribers")
required final List<ProfilePreviewModel>
subscribers}) = _$ProfileModelImpl;
factory _ProfileModel.fromJson(Map<String, dynamic> json) =
_$ProfileModelImpl.fromJson;
@@ -370,7 +474,17 @@ abstract class _ProfileModel implements ProfileModel {
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl;
@override
@JsonKey(name: "role")
String get role;
@override
@JsonKey(name: "badges")
List<BadgeModel> get badges;
@override
@JsonKey(name: "subscriptions")
List<ProfilePreviewModel> get subscriptions;
@override
@JsonKey(name: "subscribers")
List<ProfilePreviewModel> get subscribers;
/// Create a copy of ProfileModel
/// with the given fields replaced by the non-null parameter values.
@@ -1190,3 +1304,160 @@ abstract class _ProfileDetailsModel implements ProfileDetailsModel {
_$$ProfileDetailsModelImplCopyWith<_$ProfileDetailsModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}
ProfilePreviewModel _$ProfilePreviewModelFromJson(Map<String, dynamic> json) {
return _ProfilePreviewModel.fromJson(json);
}
/// @nodoc
mixin _$ProfilePreviewModel {
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl => throw _privateConstructorUsedError;
/// Serializes this ProfilePreviewModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ProfilePreviewModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProfilePreviewModelCopyWith<ProfilePreviewModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProfilePreviewModelCopyWith<$Res> {
factory $ProfilePreviewModelCopyWith(
ProfilePreviewModel value, $Res Function(ProfilePreviewModel) then) =
_$ProfilePreviewModelCopyWithImpl<$Res, ProfilePreviewModel>;
@useResult
$Res call({@JsonKey(name: "profile_photo_url") String profilePhotoUrl});
}
/// @nodoc
class _$ProfilePreviewModelCopyWithImpl<$Res, $Val extends ProfilePreviewModel>
implements $ProfilePreviewModelCopyWith<$Res> {
_$ProfilePreviewModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProfilePreviewModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? profilePhotoUrl = null,
}) {
return _then(_value.copyWith(
profilePhotoUrl: null == profilePhotoUrl
? _value.profilePhotoUrl
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$ProfilePreviewModelImplCopyWith<$Res>
implements $ProfilePreviewModelCopyWith<$Res> {
factory _$$ProfilePreviewModelImplCopyWith(_$ProfilePreviewModelImpl value,
$Res Function(_$ProfilePreviewModelImpl) then) =
__$$ProfilePreviewModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({@JsonKey(name: "profile_photo_url") String profilePhotoUrl});
}
/// @nodoc
class __$$ProfilePreviewModelImplCopyWithImpl<$Res>
extends _$ProfilePreviewModelCopyWithImpl<$Res, _$ProfilePreviewModelImpl>
implements _$$ProfilePreviewModelImplCopyWith<$Res> {
__$$ProfilePreviewModelImplCopyWithImpl(_$ProfilePreviewModelImpl _value,
$Res Function(_$ProfilePreviewModelImpl) _then)
: super(_value, _then);
/// Create a copy of ProfilePreviewModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? profilePhotoUrl = null,
}) {
return _then(_$ProfilePreviewModelImpl(
profilePhotoUrl: null == profilePhotoUrl
? _value.profilePhotoUrl
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ProfilePreviewModelImpl implements _ProfilePreviewModel {
const _$ProfilePreviewModelImpl(
{@JsonKey(name: "profile_photo_url") required this.profilePhotoUrl});
factory _$ProfilePreviewModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ProfilePreviewModelImplFromJson(json);
@override
@JsonKey(name: "profile_photo_url")
final String profilePhotoUrl;
@override
String toString() {
return 'ProfilePreviewModel(profilePhotoUrl: $profilePhotoUrl)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProfilePreviewModelImpl &&
(identical(other.profilePhotoUrl, profilePhotoUrl) ||
other.profilePhotoUrl == profilePhotoUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, profilePhotoUrl);
/// Create a copy of ProfilePreviewModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProfilePreviewModelImplCopyWith<_$ProfilePreviewModelImpl> get copyWith =>
__$$ProfilePreviewModelImplCopyWithImpl<_$ProfilePreviewModelImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ProfilePreviewModelImplToJson(
this,
);
}
}
abstract class _ProfilePreviewModel implements ProfilePreviewModel {
const factory _ProfilePreviewModel(
{@JsonKey(name: "profile_photo_url")
required final String profilePhotoUrl}) = _$ProfilePreviewModelImpl;
factory _ProfilePreviewModel.fromJson(Map<String, dynamic> json) =
_$ProfilePreviewModelImpl.fromJson;
@override
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl;
/// Create a copy of ProfilePreviewModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProfilePreviewModelImplCopyWith<_$ProfilePreviewModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}