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:
24
models/aggregation.go
Normal file
24
models/aggregation.go
Normal 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
|
||||
}
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user