users: Standardize json exports
This commit is contained in:
parent
5317daa6b8
commit
820db44d7a
11
api/users.go
11
api/users.go
|
@ -262,6 +262,17 @@ func SameUserHandler(c *gin.Context) {
|
|||
c.Next()
|
||||
}
|
||||
|
||||
// getUser shows a user in the database.
|
||||
//
|
||||
// @Summary Show user.
|
||||
// @Schemes
|
||||
// @Description Show a user from the database, information is limited to id and email if this is not the current user.
|
||||
// @Tags users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} happydns.User "The created user"
|
||||
// @Failure 500 {object} happydns.Error
|
||||
// @Router /users/{userId} [get]
|
||||
func getUser(c *gin.Context) {
|
||||
myuser := c.MustGet("LoggedUser").(*happydns.User)
|
||||
user := c.MustGet("user").(*happydns.User)
|
||||
|
|
|
@ -38,16 +38,16 @@ import (
|
|||
// User represents an account.
|
||||
type User struct {
|
||||
// Id is the User's identifier.
|
||||
Id Identifier
|
||||
Id Identifier `json:"id"`
|
||||
|
||||
// Email is the User's login and mean of contact.
|
||||
Email string
|
||||
Email string `json:"email"`
|
||||
|
||||
// CreatedAt is the time when the User logs in for the first time.
|
||||
CreatedAt time.Time `json:",omitempty"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
|
||||
// LastSeen is the time when the User used happyDNS for the last time (in a 12h frame).
|
||||
LastSeen time.Time `json:",omitempty"`
|
||||
LastSeen time.Time `json:"last_seen,omitempty"`
|
||||
|
||||
// Settings holds the settings for an account.
|
||||
Settings UserSettings `json:"settings,omitempty"`
|
||||
|
|
Loading…
Reference in New Issue