feat: add user_setting model (#145)

* feat: add `user_setting` model

* chore: add global store

* chore: update settings in web

* chore: update `i18n` example
This commit is contained in:
boojack
2022-08-13 14:35:33 +08:00
committed by GitHub
parent dfac877957
commit 90b881502d
25 changed files with 449 additions and 63 deletions

34
api/user_setting.go Normal file
View File

@ -0,0 +1,34 @@
package api
type UserSettingKey string
const (
// UserSettingLocaleKey is the key type for user locale
UserSettingLocaleKey UserSettingKey = "locale"
)
// String returns the string format of UserSettingKey type.
func (key UserSettingKey) String() string {
switch key {
case UserSettingLocaleKey:
return "locale"
}
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
}