Fixed lint + fmt
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// DeleteListItemByIDtemByID is the web handler to delete a list item
|
||||
func DeleteListItemByIDtemByID(c echo.Context) error {
|
||||
// swagger:operation DELETE /item/{itemID} lists deleteListItem
|
||||
// ---
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// GetListsByNamespaceID is the web handler to delete a namespace
|
||||
func GetListsByNamespaceID(c echo.Context) error {
|
||||
// swagger:operation GET /namespaces/{namespaceID}/lists namespaces getListsByNamespace
|
||||
// ---
|
||||
|
@ -1,13 +1,14 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
// "git.kolaente.de/konrad/list/models"
|
||||
// "git.kolaente.de/konrad/list/models"
|
||||
"github.com/labstack/echo"
|
||||
// "net/http"
|
||||
// "strconv"
|
||||
// "net/http"
|
||||
// "strconv"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// DeleteListByID ...
|
||||
func DeleteListByID(c echo.Context) error {
|
||||
// swagger:operation DELETE /lists/{listID} lists deleteList
|
||||
// ---
|
||||
@ -35,34 +36,34 @@ func DeleteListByID(c echo.Context) error {
|
||||
// "$ref": "#/responses/Message"
|
||||
|
||||
/*
|
||||
// Check if we have our ID
|
||||
id := c.Param("id")
|
||||
// Make int
|
||||
itemID, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusBadRequest, models.Message{"Invalid ID."})
|
||||
}
|
||||
|
||||
// Check if the user has the right to delete that list
|
||||
user, err := models.GetCurrentUser(c)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"An error occured."})
|
||||
}
|
||||
|
||||
// err = models.DeleteListByID(itemID, &user)
|
||||
if err != nil {
|
||||
if models.IsErrNeedToBeListAdmin(err) {
|
||||
return c.JSON(http.StatusForbidden, models.Message{"You need to be the list owner to delete a list."})
|
||||
// Check if we have our ID
|
||||
id := c.Param("id")
|
||||
// Make int
|
||||
itemID, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusBadRequest, models.Message{"Invalid ID."})
|
||||
}
|
||||
|
||||
if models.IsErrListDoesNotExist(err) {
|
||||
return c.JSON(http.StatusNotFound, models.Message{"This list does not exist."})
|
||||
// Check if the user has the right to delete that list
|
||||
user, err := models.GetCurrentUser(c)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"An error occured."})
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"An error occured."})
|
||||
}
|
||||
// err = models.DeleteListByID(itemID, &user)
|
||||
if err != nil {
|
||||
if models.IsErrNeedToBeListAdmin(err) {
|
||||
return c.JSON(http.StatusForbidden, models.Message{"You need to be the list owner to delete a list."})
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, models.Message{"The list was deleted with success."})
|
||||
if models.IsErrListDoesNotExist(err) {
|
||||
return c.JSON(http.StatusNotFound, models.Message{"This list does not exist."})
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"An error occured."})
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, models.Message{"The list was deleted with success."})
|
||||
*/
|
||||
|
||||
return echo.NewHTTPError(http.StatusNotImplemented)
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// AddListItem ...
|
||||
func AddListItem(c echo.Context) error {
|
||||
// swagger:operation PUT /lists/{listID} lists addListItem
|
||||
// ---
|
||||
@ -46,6 +47,7 @@ func AddListItem(c echo.Context) error {
|
||||
return updateOrCreateListItemHelper(listID, 0, c)
|
||||
}
|
||||
|
||||
// UpdateListItem ...
|
||||
func UpdateListItem(c echo.Context) error {
|
||||
// swagger:operation PUT /item/{itemID} lists updateListItem
|
||||
// ---
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// AddList ...
|
||||
func AddList(c echo.Context) error {
|
||||
// swagger:operation PUT /namespaces/{namespaceID}/lists lists addList
|
||||
// ---
|
||||
@ -86,6 +87,7 @@ func AddList(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, list)
|
||||
}
|
||||
|
||||
// UpdateList ...
|
||||
func UpdateList(c echo.Context) error {
|
||||
// swagger:operation POST /lists/{listID} lists upadteList
|
||||
// ---
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// AddNamespace ...
|
||||
func AddNamespace(c echo.Context) error {
|
||||
// swagger:operation PUT /namespaces namespaces addNamespace
|
||||
// ---
|
||||
@ -33,6 +34,7 @@ func AddNamespace(c echo.Context) error {
|
||||
return addOrUpdateNamespace(c)
|
||||
}
|
||||
|
||||
// UpdateNamespace ...
|
||||
func UpdateNamespace(c echo.Context) error {
|
||||
// swagger:operation POST /namespaces/{namespaceID} namespaces upadteNamespace
|
||||
// ---
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// DeleteNamespaceByID ...
|
||||
func DeleteNamespaceByID(c echo.Context) error {
|
||||
// swagger:operation DELETE /namespaces/{namespaceID} namespaces deleteNamespace
|
||||
// ---
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// ShowNamespace ...
|
||||
func ShowNamespace(c echo.Context) error {
|
||||
// swagger:operation GET /namespaces/{namespaceID} namespaces getNamespace
|
||||
// ---
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// GetAllNamespacesByCurrentUser ...
|
||||
func GetAllNamespacesByCurrentUser(c echo.Context) error {
|
||||
// swagger:operation GET /namespaces namespaces getNamespaces
|
||||
// ---
|
||||
|
@ -12,7 +12,7 @@ type swaggerParameterBodies struct {
|
||||
UserLogin models.UserLogin
|
||||
|
||||
// in:body
|
||||
ApiUserPassword models.ApiUserPassword
|
||||
APIUserPassword models.APIUserPassword
|
||||
|
||||
// in:body
|
||||
List models.List
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// RegisterUser ...
|
||||
func RegisterUser(c echo.Context) error {
|
||||
|
||||
// swagger:operation POST /register user register
|
||||
@ -20,7 +21,7 @@ func RegisterUser(c echo.Context) error {
|
||||
// - name: body
|
||||
// in: body
|
||||
// schema:
|
||||
// "$ref": "#/definitions/ApiUserPassword"
|
||||
// "$ref": "#/definitions/APIUserPassword"
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/User"
|
||||
@ -38,7 +39,7 @@ func userAddOrUpdate(c echo.Context) error {
|
||||
// TODO: prevent everyone from updating users
|
||||
|
||||
// Check for Request Content
|
||||
var datUser *models.ApiUserPassword
|
||||
var datUser *models.APIUserPassword
|
||||
|
||||
if err := c.Bind(&datUser); err != nil {
|
||||
return c.JSON(http.StatusBadRequest, models.Message{"No user model provided."})
|
||||
|
Reference in New Issue
Block a user