Add methods and fields for comments associated with post.
This commit is contained in:
Mikwk 2020-08-05 17:03:21 +02:00
parent b5e8620931
commit cf09486479
1 changed files with 46 additions and 44 deletions

View File

@ -2,52 +2,54 @@ import 'package:json_annotation/json_annotation.dart';
part 'post.g.dart'; part 'post.g.dart';
//TODO: Add methods and fields for comments associated with post.
@JsonSerializable() @JsonSerializable()
class PostView { class PostView {
PostView( PostView(
this.id, this.id,
this.postName, this.postName,
this.url, this.url,
this.body, this.body,
this.creatorId, this.creatorId,
this.communityId, this.communityId,
this.removed, this.removed,
this.locked, this.locked,
this.published, this.published,
this.updated, this.updated,
this.deleted, this.deleted,
this.nsfw, this.nsfw,
this.stickied, this.stickied,
this.embedTitle, this.embedTitle,
this.embedDescription, this.embedDescription,
this.embedHtml, this.embedHtml,
this.thumbnailUrl, this.thumbnailUrl,
this.apId, this.apId,
this.local, this.local,
this.creatorActorId, this.creatorActorId,
this.creatorLocal, this.creatorLocal,
this.creatorName, this.creatorName,
this.creatorPublished, this.creatorPublished,
this.creatorAvatar, this.creatorAvatar,
this.banned, this.banned,
this.bannedFromCommunity, this.bannedFromCommunity,
this.communityActorId, this.communityActorId,
this.communityLocal, this.communityLocal,
this.communityName, this.communityName,
this.communityRemoved, this.communityRemoved,
this.communityDeleted, this.communityDeleted,
this.communityNsfw, this.communityNsfw,
this.numberOfComments, this.numberOfComments,
this.score, this.score,
this.upvotes, this.upvotes,
this.downvotes, this.downvotes,
this.hotRank, this.hotRank,
this.newestActivityTime, this.newestActivityTime,
int userId, int userId,
int myVote, int myVote,
bool subscribed, bool subscribed,
bool read, bool read,
bool saved) { bool saved,
) {
_userId = userId; _userId = userId;
_myVote = myVote; _myVote = myVote;
_subscribed = subscribed; _subscribed = subscribed;
@ -186,7 +188,7 @@ class PostView {
return _myVote; return _myVote;
} }
void set myVote(int myVote) => _myVote = myVote>0?1:myVote<0?-1:0; void set myVote(int myVote) => _myVote = myVote > 0 ? 1 : myVote < 0 ? -1 : 0;
@JsonKey(name: "my_vote") @JsonKey(name: "my_vote")
int _myVote; int _myVote;