2016-03-06 05:15:49 +08:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Typed errors
|
|
|
|
var (
|
2016-03-07 04:32:22 +08:00
|
|
|
ErrPreferencesNotFound = errors.New("Preferences not found")
|
2016-03-06 05:15:49 +08:00
|
|
|
)
|
|
|
|
|
2016-03-06 19:47:39 +08:00
|
|
|
type Preferences struct {
|
|
|
|
Id int64
|
|
|
|
PrefId int64
|
|
|
|
PrefType string
|
|
|
|
PrefData map[string]interface{}
|
2016-03-06 05:15:49 +08:00
|
|
|
}
|
|
|
|
|
2016-03-07 03:42:15 +08:00
|
|
|
// ---------------------
|
|
|
|
// QUERIES
|
|
|
|
|
|
|
|
type GetPreferencesQuery struct {
|
|
|
|
PrefId int64
|
|
|
|
PrefType string
|
|
|
|
|
2016-03-07 04:32:22 +08:00
|
|
|
Result *Preferences
|
2016-03-07 03:42:15 +08:00
|
|
|
}
|
|
|
|
|
2016-03-06 05:15:49 +08:00
|
|
|
// ---------------------
|
|
|
|
// COMMANDS
|
|
|
|
|
2016-03-06 19:47:39 +08:00
|
|
|
type SavePreferencesCommand struct {
|
|
|
|
PrefData map[string]interface{} `json:"prefData" binding:"Required"`
|
|
|
|
PrefId int64 `json:"-"`
|
2016-03-06 05:15:49 +08:00
|
|
|
PrefType string `json:"-"`
|
|
|
|
}
|
2016-03-07 03:42:15 +08:00
|
|
|
|
|
|
|
// ----------------------
|
|
|
|
// DTO & Projections
|
|
|
|
|
|
|
|
type PreferencesDTO struct {
|
|
|
|
PrefId int64 `json:"prefId"`
|
|
|
|
PrefType string `json:"prefType"`
|
|
|
|
PrefData map[string]interface{} `json:"prefData"`
|
|
|
|
}
|