|
|
@@ -12,28 +12,28 @@ import (
|
|
|
|
|
|
// User represents a user in the system.
|
|
|
type User struct {
|
|
|
- ID int64 `json:"id"`
|
|
|
- Username string `json:"username"`
|
|
|
- Password string `json:"-"`
|
|
|
- IsAdmin bool `json:"is_admin"`
|
|
|
- Theme string `json:"theme"`
|
|
|
- Language string `json:"language"`
|
|
|
- Timezone string `json:"timezone"`
|
|
|
- EntryDirection string `json:"entry_sorting_direction"`
|
|
|
- EntryOrder string `json:"entry_sorting_order"`
|
|
|
- Stylesheet string `json:"stylesheet"`
|
|
|
- GoogleID string `json:"google_id"`
|
|
|
- OpenIDConnectID string `json:"openid_connect_id"`
|
|
|
- EntriesPerPage int `json:"entries_per_page"`
|
|
|
- KeyboardShortcuts bool `json:"keyboard_shortcuts"`
|
|
|
- ShowReadingTime bool `json:"show_reading_time"`
|
|
|
- EntrySwipe bool `json:"entry_swipe"`
|
|
|
- LastLoginAt *time.Time `json:"last_login_at"`
|
|
|
- DisplayMode string `json:"display_mode"`
|
|
|
- DefaultReadingSpeed int `json:"default_reading_speed"`
|
|
|
- CJKReadingSpeed int `json:"cjk_reading_speed"`
|
|
|
- DefaultHomePage string `json:"default_home_page"`
|
|
|
- CategoriesSortOrder string `json:"categories_sort_order"`
|
|
|
+ ID int64 `json:"id"`
|
|
|
+ Username string `json:"username"`
|
|
|
+ Password string `json:"-"`
|
|
|
+ IsAdmin bool `json:"is_admin"`
|
|
|
+ Theme string `json:"theme"`
|
|
|
+ Language string `json:"language"`
|
|
|
+ Timezone string `json:"timezone"`
|
|
|
+ EntryDirection string `json:"entry_sorting_direction"`
|
|
|
+ EntryOrder string `json:"entry_sorting_order"`
|
|
|
+ Stylesheet string `json:"stylesheet"`
|
|
|
+ GoogleID string `json:"google_id"`
|
|
|
+ OpenIDConnectID string `json:"openid_connect_id"`
|
|
|
+ EntriesPerPage int `json:"entries_per_page"`
|
|
|
+ KeyboardShortcuts bool `json:"keyboard_shortcuts"`
|
|
|
+ ShowReadingTime bool `json:"show_reading_time"`
|
|
|
+ EntrySwipe bool `json:"entry_swipe"`
|
|
|
+ LastLoginAt *time.Time `json:"last_login_at"`
|
|
|
+ DisplayMode string `json:"display_mode"`
|
|
|
+ DefaultReadingSpeed int `json:"default_reading_speed"`
|
|
|
+ CJKReadingSpeed int `json:"cjk_reading_speed"`
|
|
|
+ DefaultHomePage string `json:"default_home_page"`
|
|
|
+ CategoriesSortingOrder string `json:"categories_sorting_order"`
|
|
|
}
|
|
|
|
|
|
// UserCreationRequest represents the request to create a user.
|
|
|
@@ -47,26 +47,26 @@ type UserCreationRequest struct {
|
|
|
|
|
|
// UserModificationRequest represents the request to update a user.
|
|
|
type UserModificationRequest struct {
|
|
|
- Username *string `json:"username"`
|
|
|
- Password *string `json:"password"`
|
|
|
- Theme *string `json:"theme"`
|
|
|
- Language *string `json:"language"`
|
|
|
- Timezone *string `json:"timezone"`
|
|
|
- EntryDirection *string `json:"entry_sorting_direction"`
|
|
|
- EntryOrder *string `json:"entry_sorting_order"`
|
|
|
- Stylesheet *string `json:"stylesheet"`
|
|
|
- GoogleID *string `json:"google_id"`
|
|
|
- OpenIDConnectID *string `json:"openid_connect_id"`
|
|
|
- EntriesPerPage *int `json:"entries_per_page"`
|
|
|
- IsAdmin *bool `json:"is_admin"`
|
|
|
- KeyboardShortcuts *bool `json:"keyboard_shortcuts"`
|
|
|
- ShowReadingTime *bool `json:"show_reading_time"`
|
|
|
- EntrySwipe *bool `json:"entry_swipe"`
|
|
|
- DisplayMode *string `json:"display_mode"`
|
|
|
- DefaultReadingSpeed *int `json:"default_reading_speed"`
|
|
|
- CJKReadingSpeed *int `json:"cjk_reading_speed"`
|
|
|
- DefaultHomePage *string `json:"default_home_page"`
|
|
|
- CategoriesSortOrder *string `json:"categories_sort_order"`
|
|
|
+ Username *string `json:"username"`
|
|
|
+ Password *string `json:"password"`
|
|
|
+ Theme *string `json:"theme"`
|
|
|
+ Language *string `json:"language"`
|
|
|
+ Timezone *string `json:"timezone"`
|
|
|
+ EntryDirection *string `json:"entry_sorting_direction"`
|
|
|
+ EntryOrder *string `json:"entry_sorting_order"`
|
|
|
+ Stylesheet *string `json:"stylesheet"`
|
|
|
+ GoogleID *string `json:"google_id"`
|
|
|
+ OpenIDConnectID *string `json:"openid_connect_id"`
|
|
|
+ EntriesPerPage *int `json:"entries_per_page"`
|
|
|
+ IsAdmin *bool `json:"is_admin"`
|
|
|
+ KeyboardShortcuts *bool `json:"keyboard_shortcuts"`
|
|
|
+ ShowReadingTime *bool `json:"show_reading_time"`
|
|
|
+ EntrySwipe *bool `json:"entry_swipe"`
|
|
|
+ DisplayMode *string `json:"display_mode"`
|
|
|
+ DefaultReadingSpeed *int `json:"default_reading_speed"`
|
|
|
+ CJKReadingSpeed *int `json:"cjk_reading_speed"`
|
|
|
+ DefaultHomePage *string `json:"default_home_page"`
|
|
|
+ CategoriesSortingOrder *string `json:"categories_sorting_order"`
|
|
|
}
|
|
|
|
|
|
// Patch updates the User object with the modification request.
|
|
|
@@ -147,8 +147,8 @@ func (u *UserModificationRequest) Patch(user *User) {
|
|
|
user.DefaultHomePage = *u.DefaultHomePage
|
|
|
}
|
|
|
|
|
|
- if u.CategoriesSortOrder != nil {
|
|
|
- user.CategoriesSortOrder = *u.CategoriesSortOrder
|
|
|
+ if u.CategoriesSortingOrder != nil {
|
|
|
+ user.CategoriesSortingOrder = *u.CategoriesSortingOrder
|
|
|
}
|
|
|
}
|
|
|
|