2019-05-19 20:49:27 +03:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
NSummaryTypes uint8 = 4
|
|
|
|
SummaryProject uint8 = 0
|
|
|
|
SummaryLanguage uint8 = 1
|
|
|
|
SummaryEditor uint8 = 2
|
|
|
|
SummaryOS uint8 = 3
|
|
|
|
)
|
|
|
|
|
|
|
|
type Summary struct {
|
2019-10-11 09:00:02 +03:00
|
|
|
ID uint `json:"-" gorm:"primary_key"`
|
|
|
|
UserID string `json:"user_id" gorm:"not null; index:idx_time_summary_user"`
|
|
|
|
FromTime time.Time `json:"from" gorm:"not null; type:timestamp; default:now(); index:idx_time_summary_user"`
|
|
|
|
ToTime time.Time `json:"to" gorm:"not null; type:timestamp; default:now(); index:idx_time_summary_user"`
|
|
|
|
Projects []*SummaryItem `json:"projects"`
|
|
|
|
Languages []*SummaryItem `json:"languages"`
|
|
|
|
Editors []*SummaryItem `json:"editors"`
|
|
|
|
OperatingSystems []*SummaryItem `json:"operating_systems"`
|
2019-05-19 20:49:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
type SummaryItem struct {
|
2019-10-10 00:26:28 +03:00
|
|
|
ID uint `json:"-" gorm:"primary_key"`
|
|
|
|
SummaryID uint `json:"-"`
|
2019-10-10 19:32:17 +03:00
|
|
|
Type uint8 `json:"-"`
|
2019-10-10 00:26:28 +03:00
|
|
|
Key string `json:"key"`
|
|
|
|
Total time.Duration `json:"total"`
|
2019-05-19 20:49:27 +03:00
|
|
|
}
|
2019-05-19 22:00:19 +03:00
|
|
|
|
|
|
|
type SummaryItemContainer struct {
|
|
|
|
Type uint8
|
2019-10-11 09:00:02 +03:00
|
|
|
Items []*SummaryItem
|
2019-05-19 22:00:19 +03:00
|
|
|
}
|
2020-03-31 12:24:44 +03:00
|
|
|
|
|
|
|
type SummaryViewModel struct {
|
|
|
|
*Summary
|
|
|
|
LanguageColors map[string]string
|
|
|
|
}
|