aboutsummaryrefslogtreecommitdiffstats
path: root/modules/structs
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-06-23 21:58:44 +0200
committerGitHub <noreply@github.com>2021-06-23 15:58:44 -0400
commit58501a26821160c3258c1ad3501f4c1d8db0a597 (patch)
treed8a75bc1e8145e83b02c220006b9bc24d8ba2f9b /modules/structs
parent8640717f5fb045ee88eda14c7dbe3731b8c068b2 (diff)
downloadgitea-58501a26821160c3258c1ad3501f4c1d8db0a597.tar.gz
gitea-58501a26821160c3258c1ad3501f4c1d8db0a597.zip
[API] GET / SET User Settings (#16169)
* API: GET/SET User Settings * linter * Apply suggestions from code review * Update modules/structs/user.go * lint * fix swagger * move User2UserSettings to convert * as per @zeripath "preferences" -> "settings" Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules/structs')
-rw-r--r--modules/structs/user.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/structs/user.go b/modules/structs/user.go
index de2e68c2a2..0d8b0300c3 100644
--- a/modules/structs/user.go
+++ b/modules/structs/user.go
@@ -60,3 +60,33 @@ func (u User) MarshalJSON() ([]byte, error) {
CompatUserName string `json:"username"`
}{shadow(u), u.UserName})
}
+
+// UserSettings represents user settings
+// swagger:model
+type UserSettings struct {
+ FullName string `json:"full_name"`
+ Website string `json:"website"`
+ Description string `json:"description"`
+ Location string `json:"location"`
+ Language string `json:"language"`
+ Theme string `json:"theme"`
+ DiffViewStyle string `json:"diff_view_style"`
+ // Privacy
+ HideEmail bool `json:"hide_email"`
+ HideActivity bool `json:"hide_activity"`
+}
+
+// UserSettingsOptions represents options to change user settings
+// swagger:model
+type UserSettingsOptions struct {
+ FullName *string `json:"full_name" binding:"MaxSize(100)"`
+ Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"`
+ Description *string `json:"description" binding:"MaxSize(255)"`
+ Location *string `json:"location" binding:"MaxSize(50)"`
+ Language *string `json:"language"`
+ Theme *string `json:"theme"`
+ DiffViewStyle *string `json:"diff_view_style"`
+ // Privacy
+ HideEmail *bool `json:"hide_email"`
+ HideActivity *bool `json:"hide_activity"`
+}