From 75db7bcc7ad36dd3b4a88b6319e91962fea2e995 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 9 Jan 2024 06:54:22 -0500 Subject: [PATCH] feat: implement upvote and downvote --- interfaces/vote.go | 2 ++ service/vote.go | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/interfaces/vote.go b/interfaces/vote.go index dbfb1c1..7f6b3e7 100644 --- a/interfaces/vote.go +++ b/interfaces/vote.go @@ -9,4 +9,6 @@ type NodeVotes interface { msgpack.CustomDecoder Good() int Bad() int + Upvote() + Downvote() } diff --git a/service/vote.go b/service/vote.go index 1748288..e8c9ab1 100644 --- a/service/vote.go +++ b/service/vote.go @@ -55,3 +55,11 @@ func (n *NodeVotesImpl) DecodeMsgpack(dec *msgpack.Decoder) error { return nil } + +func (n *NodeVotesImpl) Upvote() { + n.good++ +} + +func (n *NodeVotesImpl) Downvote() { + n.bad++ +}