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

@@ -1,3 +1,4 @@
import 'package:eatvio_app/features/profile/models/badge_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'profile_model.freezed.dart';
@@ -16,7 +17,10 @@ class ProfileModel with _$ProfileModel {
@JsonKey(name: "is_public_profile") required bool isPublicProfile,
@JsonKey(name: "slug") required String slug,
@JsonKey(name: "profile_photo_url") required String profilePhotoUrl,
required String role,
@JsonKey(name: "role") required String role,
@JsonKey(name: "badges") required List<BadgeModel> badges,
@JsonKey(name: "subscriptions") required List<ProfilePreviewModel> subscriptions,
@JsonKey(name: "subscribers") required List<ProfilePreviewModel> subscribers,
}) = _ProfileModel;
factory ProfileModel.fromJson(Map<String, dynamic> json) => _$ProfileModelFromJson(json);
@@ -56,3 +60,12 @@ class ProfileDetailsModel with _$ProfileDetailsModel {
factory ProfileDetailsModel.fromJson(Map<String, dynamic> json) => _$ProfileDetailsModelFromJson(json);
}
@freezed
class ProfilePreviewModel with _$ProfilePreviewModel {
const factory ProfilePreviewModel({
@JsonKey(name: "profile_photo_url") required String profilePhotoUrl,
}) = _ProfilePreviewModel;
factory ProfilePreviewModel.fromJson(Map<String, dynamic> json) => _$ProfilePreviewModelFromJson(json);
}