added CommunityModerator and CommunityFollower views

This commit is contained in:
shilangyu 2020-08-10 11:52:42 +00:00
parent f0bfdba132
commit 3aa92f695d
1 changed files with 87 additions and 0 deletions

View File

@ -84,3 +84,90 @@ class CommunityView {
factory CommunityView.fromJson(Map<String, dynamic> json) =>
_$CommunityViewFromJson(json);
}
/// based on https://github.com/LemmyNet/lemmy/blob/464ea862b10fa7b226b2550268e40d8e685a939c/server/lemmy_db/src/community_view.rs#L336
@JsonSerializable(fieldRename: FieldRename.snake, createToJson: false)
class CommunityFollowerView {
final int id;
final int communityId;
final int userId;
final DateTime published;
final String userActorId;
final bool userLocal;
final String userName;
/// can be null
final String userPreferredUsername;
/// can be null
final String avatar;
final String communityActorId;
final bool communityLocal;
final String communityName;
/// can be null
final String communityIcon;
const CommunityFollowerView({
this.id,
this.communityId,
this.userId,
this.published,
this.userActorId,
this.userLocal,
this.userName,
this.userPreferredUsername,
this.avatar,
this.communityActorId,
this.communityLocal,
this.communityName,
this.communityIcon,
});
factory CommunityFollowerView.fromJson(Map<String, dynamic> json) =>
_$CommunityFollowerViewFromJson(json);
}
/// based on https://github.com/LemmyNet/lemmy/blob/464ea862b10fa7b226b2550268e40d8e685a939c/server/lemmy_db/src/community_view.rs#L298
@JsonSerializable(fieldRename: FieldRename.snake, createToJson: false)
class CommunityModeratorView {
final int id;
final int communityId;
final int userId;
final DateTime published;
final String userActorId;
final bool userLocal;
final String userName;
/// can be null
final String userPreferredUsername;
/// can be null
final String avatar;
final String communityActorId;
final bool communityLocal;
final String communityName;
/// can be null
final String communityIcon;
const CommunityModeratorView({
this.id,
this.communityId,
this.userId,
this.published,
this.userActorId,
this.userLocal,
this.userName,
this.userPreferredUsername,
this.avatar,
this.communityActorId,
this.communityLocal,
this.communityName,
this.communityIcon,
});
factory CommunityModeratorView.fromJson(Map<String, dynamic> json) =>
_$CommunityModeratorViewFromJson(json);
}