summaryrefslogtreecommitdiff
path: root/owner
diff options
context:
space:
mode:
authorVitaly Minko <vitaly.minko@gmail.com>2019-01-18 12:39:32 +0300
committerVitaly Minko <vitaly.minko@gmail.com>2019-01-18 12:39:32 +0300
commit3e2505fb05a81d3a9959b8fd251f98dab35470c5 (patch)
tree00cacaaabc7a0780e68bcd4faf6d111885433080 /owner
parentaa316d31c70288a3319c1b2c5aad08cbce12ed78 (diff)
Implemented lshist command. Added autotests for the user history feature.
Diffstat (limited to 'owner')
-rw-r--r--owner/profile.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/owner/profile.go b/owner/profile.go
index b4aecc3..94adcce 100644
--- a/owner/profile.go
+++ b/owner/profile.go
@@ -19,7 +19,6 @@ package owner
import (
"sync"
- "time"
"vminko.org/dscuss/entity"
"vminko.org/dscuss/errors"
"vminko.org/dscuss/log"
@@ -124,18 +123,18 @@ func (p *Profile) GetSubscriptions() subs.Subscriptions {
return p.subs.Copy()
}
-func (p *Profile) PutUserHistory(id *entity.ID, discon time.Time, sub subs.Subscriptions) error {
- err := p.db.RemoveUserHistory(id)
- if err != nil {
- return err
- }
- return p.db.PutUserHistory(id, discon, sub)
+func (p *Profile) PutUserHistory(h *entity.UserHistory) error {
+ return p.db.PutUserHistory(h)
}
-func (p *Profile) GetUserHistory(id *entity.ID) (time.Time, subs.Subscriptions, error) {
+func (p *Profile) GetUserHistory(id *entity.ID) (*entity.UserHistory, error) {
return p.db.GetUserHistory(id)
}
-func (p *Profile) RemoveUserHistory(id *entity.ID) error {
- return p.db.RemoveUserHistory(id)
+func (p *Profile) GetFullHistory() []*entity.UserHistory {
+ h, err := p.db.GetFullHistory()
+ if err != nil {
+ log.Fatalf("Failed to fetch full history from the profile database: %v", err)
+ }
+ return h
}