Implemented GetUserPreferences API
This commit is contained in:
+1
-1
@@ -96,7 +96,7 @@ func Register(r *macaron.Macaron) {
|
||||
r.Delete("/stars/dashboard/:id", wrap(UnstarDashboard))
|
||||
r.Put("/password", bind(m.ChangeUserPasswordCommand{}), wrap(ChangeUserPassword))
|
||||
r.Get("/quotas", wrap(GetUserQuotas))
|
||||
r.Put("/prefs", bind(m.SavePreferencesCommand{}), wrap(SaveUserPreferences))
|
||||
r.Combo("/prefs").Get(GetUserPreferences).Put(bind(m.SavePreferencesCommand{}), wrap(SaveUserPreferences))
|
||||
})
|
||||
|
||||
// users (admin permission required)
|
||||
|
||||
@@ -19,3 +19,14 @@ func SaveUserPreferences(c *middleware.Context, cmd m.SavePreferencesCommand) Re
|
||||
return ApiSuccess("User preferences saved")
|
||||
|
||||
}
|
||||
|
||||
func GetUserPreferences(c *middleware.Context) Response {
|
||||
|
||||
query := m.GetPreferencesQuery{PrefId: c.UserId, PrefType: `user`}
|
||||
|
||||
if err := bus.Dispatch(&query); err != nil {
|
||||
return ApiError(500, "Failed to get user", err)
|
||||
}
|
||||
|
||||
return Json(200, query.Result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user