GetUserByID returns the user by id swagger:operation GET /user/{id} user getUser Get a user. --- consumes: [application/json] produces: [application/json] security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] parameters: - name: id in:
(ctx *gin.Context)
| 256 | // schema: |
| 257 | // $ref: "#/definitions/Error" |
| 258 | func (a *UserAPI) GetUserByID(ctx *gin.Context) { |
| 259 | withID(ctx, "id", func(id uint) { |
| 260 | user, err := a.DB.GetUserByID(id) |
| 261 | if success := successOrAbort(ctx, 500, err); !success { |
| 262 | return |
| 263 | } |
| 264 | if user != nil { |
| 265 | ctx.JSON(200, toExternalUser(user)) |
| 266 | } else { |
| 267 | ctx.AbortWithError(404, errors.New("user does not exist")) |
| 268 | } |
| 269 | }) |
| 270 | } |
| 271 | |
| 272 | // DeleteUserByID deletes the user by id |
| 273 | // swagger:operation DELETE /user/{id} user deleteUser |
nothing calls this directly
no test coverage detected