Limited ListEntries to user

This commit is contained in:
マリウス 2020-10-15 22:44:48 +01:00
parent ee499f5c3e
commit f2b3fd06a8
No known key found for this signature in database
GPG key ID: C228EF0A530AF06F

View file

@ -130,11 +130,11 @@ func (database *Database) GetRunningEntryId(user string) (string, error) {
return runningId, dberr return runningId, dberr
} }
func (database *Database) ListEntries() ([]Entry, error) { func (database *Database) ListEntries(user string) ([]Entry, error) {
var entries []Entry var entries []Entry
dberr := database.DB.View(func(tx *buntdb.Tx) error { dberr := database.DB.View(func(tx *buntdb.Tx) error {
tx.AscendKeys("*:entry:*", func(key, value string) bool { tx.AscendKeys(user + ":entry:*", func(key, value string) bool {
var entry Entry var entry Entry
json.Unmarshal([]byte(value), &entry) json.Unmarshal([]byte(value), &entry)