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

Fix heartbeats insertion.

Add OS and editor fields.
Introduce aggregations (not working yet).
This commit is contained in:
Ferdinand Mütsch
2019-05-09 00:07:38 +02:00
parent 3bc706ed4b
commit d1be4ce2a3
8 changed files with 187 additions and 15 deletions

24
models/aggregation.go Normal file
View File

@ -0,0 +1,24 @@
package models
import "time"
type AggregationType string
const (
AggregationProject AggregationType = "project"
AggregationLanguage AggregationType = "language"
AggregationEditor AggregationType = "editor"
AggregationOS AggregationType = "os"
)
type Aggregation struct {
From time.Time
To time.Time
Type AggregationType
Items []AggregationItem
}
type AggregationItem struct {
Key string
Total time.Duration
}

View File

@ -9,15 +9,17 @@ import (
type HeartbeatReqTime time.Time
type Heartbeat struct {
User string `json:"user"`
Entity string `json:"entity"`
Type string `json:"type"`
Category string `json:"category"`
Project string `json:"project"`
Branch string `json:"branch"`
Language string `json:"language"`
IsWrite bool `json:"is_write"`
Time HeartbeatReqTime `json:"time"`
User string `json:"user"`
Entity string `json:"entity"`
Type string `json:"type"`
Category string `json:"category"`
Project string `json:"project"`
Branch string `json:"branch"`
Language string `json:"language"`
IsWrite bool `json:"is_write"`
Editor string `json:"editor"`
OperatingSystem string `json:"operating_system"`
Time HeartbeatReqTime `json:"time"`
}
func (j *HeartbeatReqTime) UnmarshalJSON(b []byte) error {