2022-08-13 09:35:33 +03:00
|
|
|
package api
|
|
|
|
|
|
|
|
type UserSettingKey string
|
|
|
|
|
|
|
|
const (
|
2022-08-18 19:00:47 +03:00
|
|
|
// UserSettingLocaleKey is the key type for user locale.
|
2022-08-13 09:35:33 +03:00
|
|
|
UserSettingLocaleKey UserSettingKey = "locale"
|
2022-08-18 19:00:47 +03:00
|
|
|
// UserSettingMemoVisibilityKey is the key type for user perference memo default visibility.
|
2022-08-19 16:56:22 +03:00
|
|
|
UserSettingMemoVisibilityKey UserSettingKey = "memoVisibility"
|
2022-08-13 09:35:33 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// String returns the string format of UserSettingKey type.
|
|
|
|
func (key UserSettingKey) String() string {
|
|
|
|
switch key {
|
|
|
|
case UserSettingLocaleKey:
|
|
|
|
return "locale"
|
2022-08-18 19:00:47 +03:00
|
|
|
case UserSettingMemoVisibilityKey:
|
2022-08-19 16:56:22 +03:00
|
|
|
return "memoVisibility"
|
2022-08-13 09:35:33 +03:00
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
type UserSetting struct {
|
|
|
|
UserID int
|
|
|
|
Key UserSettingKey `json:"key"`
|
|
|
|
// Value is a JSON string with basic value
|
|
|
|
Value string `json:"value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UserSettingUpsert struct {
|
|
|
|
UserID int
|
|
|
|
Key UserSettingKey `json:"key"`
|
|
|
|
Value string `json:"value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UserSettingFind struct {
|
|
|
|
UserID int
|
2022-08-18 19:00:47 +03:00
|
|
|
|
|
|
|
Key *UserSettingKey `json:"key"`
|
2022-08-13 09:35:33 +03:00
|
|
|
}
|