Exemplo n.º 1
0
// ItemBoard gets a specific board, identified by project ID or
// NAMESPACE/BOARD_NAME, which is owned by the authenticated user.
func ItemBoard(ctx *middleware.Context) {
	board, err := models.ItemBoard(ctx.User, ctx.Provider, ctx.Query("project_id"))

	if err != nil {
		ctx.JSON(http.StatusUnauthorized, &models.ResponseError{
			Success: false,
			Message: err.Error(),
		})
		return
	}

	ctx.JSON(http.StatusOK, &models.Response{
		Data: board,
	})
}
Exemplo n.º 2
0
// ItemBoard gets a specific board, identified by project ID or
// NAMESPACE/BOARD_NAME, which is owned by the authenticated user.
func ItemBoard(ctx *middleware.Context) {
	board, err := models.ItemBoard(ctx.User, ctx.Provider, ctx.Query("project_id"))

	if err != nil {
		if err, ok := err.(models.ReceivedDataErr); ok {
			ctx.JSON(err.StatusCode, &models.ResponseError{
				Success: false,
				Message: err.Error(),
			})
		}
		ctx.JSON(http.StatusInternalServerError, &models.ResponseError{
			Success: false,
			Message: err.Error(),
		})
		return
	}

	ctx.JSON(http.StatusOK, &models.Response{
		Data: board,
	})
}