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