2016-03-05 13:15:49 -08:00
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"errors"
|
2016-03-14 03:12:52 -07:00
|
|
|
"time"
|
2016-03-05 13:15:49 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Typed errors
|
|
|
|
|
var (
|
2016-03-06 12:32:22 -08:00
|
|
|
ErrPreferencesNotFound = errors.New("Preferences not found")
|
2016-03-05 13:15:49 -08:00
|
|
|
)
|
|
|
|
|
|
2016-03-06 03:47:39 -08:00
|
|
|
type Preferences struct {
|
2016-03-15 22:49:52 +01:00
|
|
|
Id int64
|
|
|
|
|
OrgId int64
|
|
|
|
|
UserId int64
|
|
|
|
|
Version int
|
|
|
|
|
HomeDashboardId int64
|
|
|
|
|
Timezone string
|
|
|
|
|
Theme string
|
|
|
|
|
Created time.Time
|
|
|
|
|
Updated time.Time
|
2016-03-05 13:15:49 -08:00
|
|
|
}
|
|
|
|
|
|
2016-03-06 11:42:15 -08:00
|
|
|
// ---------------------
|
|
|
|
|
// QUERIES
|
|
|
|
|
|
|
|
|
|
type GetPreferencesQuery struct {
|
2016-03-11 06:30:05 -08:00
|
|
|
Id int64
|
|
|
|
|
OrgId int64
|
2016-03-14 03:12:52 -07:00
|
|
|
UserId int64
|
2016-03-06 11:42:15 -08:00
|
|
|
|
2016-03-06 12:32:22 -08:00
|
|
|
Result *Preferences
|
2016-03-06 11:42:15 -08:00
|
|
|
}
|
|
|
|
|
|
2016-04-02 13:54:06 -07:00
|
|
|
type GetPreferencesWithDefaultsQuery struct {
|
|
|
|
|
Id int64
|
|
|
|
|
OrgId int64
|
|
|
|
|
UserId int64
|
|
|
|
|
|
|
|
|
|
Result *Preferences
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-05 13:15:49 -08:00
|
|
|
// ---------------------
|
|
|
|
|
// COMMANDS
|
2016-03-06 03:47:39 -08:00
|
|
|
type SavePreferencesCommand struct {
|
2016-03-15 22:49:52 +01:00
|
|
|
UserId int64
|
|
|
|
|
OrgId int64
|
2016-03-06 11:42:15 -08:00
|
|
|
|
2016-03-16 23:35:06 -07:00
|
|
|
HomeDashboardId int64 `json:"homeDashboardId"`
|
|
|
|
|
Timezone string `json:"timezone"`
|
|
|
|
|
Theme string `json:"theme"`
|
2016-03-06 11:42:15 -08:00
|
|
|
}
|