1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

Add documentation for aliases.

Reload aliases for every summary request.
This commit is contained in:
Ferdinand Mütsch
2019-07-07 10:32:28 +02:00
parent e98acb8315
commit e18a873428
4 changed files with 23 additions and 11 deletions

View File

@ -2,7 +2,6 @@ package routes
import (
"crypto/md5"
"log"
"net/http"
"strconv"
"time"
@ -14,7 +13,7 @@ import (
)
const (
IntervalToday string = "today"
IntervalToday string = "today"
IntervalLastDay string = "day"
IntervalLastWeek string = "week"
IntervalLastMonth string = "month"
@ -45,15 +44,8 @@ func (h *SummaryHandler) Get(w http.ResponseWriter, r *http.Request) {
}
user := r.Context().Value(models.UserKey).(*models.User)
// Initialize aliases for user
if !h.SummarySrvc.AliasService.IsInitialized(user.ID) {
log.Printf("Initializing aliases for user '%s'\n", user.ID)
h.SummarySrvc.AliasService.InitUser(user.ID)
}
params := r.URL.Query()
interval := params.Get("interval")
interval := params.Get("interval")
from, err := utils.ParseDate(params.Get("from"))
if err != nil {
switch interval {