diff --git a/routes/api/v1/authors_add_update.go b/routes/api/v1/authors_add_update.go index 7f1e551..238e5fe 100644 --- a/routes/api/v1/authors_add_update.go +++ b/routes/api/v1/authors_add_update.go @@ -50,11 +50,11 @@ func AuthorAddOrUpdate(c echo.Context) error { if datAuthor.ID != 0 { _, exists, err := models.GetAuthorByID(datAuthor.ID) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the author exists"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the author exists."}) } if !exists { - return c.JSON(http.StatusNotFound, models.Message{"The author does not exist"}) + return c.JSON(http.StatusNotFound, models.Message{"The author does not exist."}) } } @@ -68,7 +68,7 @@ func AuthorAddOrUpdate(c echo.Context) error { // Log the action err = models.LogAction("Added or updated an author", newAuthor.ID, c) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not log"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not log."}) } return c.JSON(http.StatusOK, newAuthor) diff --git a/routes/api/v1/authors_list.go b/routes/api/v1/authors_list.go index 47bb978..44ef82c 100644 --- a/routes/api/v1/authors_list.go +++ b/routes/api/v1/authors_list.go @@ -15,7 +15,7 @@ func AuthorsList(c echo.Context) error { list, err := models.ListAuthors(search) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Error getting authors"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Error getting authors."}) } return c.JSON(http.StatusOK, list) diff --git a/routes/api/v1/book_show.go b/routes/api/v1/book_show.go index 7816cba..b00f7b4 100644 --- a/routes/api/v1/book_show.go +++ b/routes/api/v1/book_show.go @@ -22,7 +22,7 @@ func BookShow(c echo.Context) error { bookInfo, exists, err := models.GetBookByID(bookID) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not get book infos"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not get book infos."}) } // Check if it exists diff --git a/routes/api/v1/books_add_update.go b/routes/api/v1/books_add_update.go index 97546bb..7d2f9a1 100644 --- a/routes/api/v1/books_add_update.go +++ b/routes/api/v1/books_add_update.go @@ -17,7 +17,7 @@ func BookAddOrUpdate(c echo.Context) error { if bookFromString == "" { if err := c.Bind(&datBook); err != nil { - return c.JSON(http.StatusBadRequest, models.Message{"No book model provided"}) + return c.JSON(http.StatusBadRequest, models.Message{"No book model provided."}) } } else { // Decode the JSON @@ -36,7 +36,7 @@ func BookAddOrUpdate(c echo.Context) error { bookID, err := strconv.ParseInt(id, 10, 64) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not get book id"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not get book id."}) } datBook.ID = bookID } @@ -45,11 +45,11 @@ func BookAddOrUpdate(c echo.Context) error { if datBook.ID != 0 { _, exists, err := models.GetBookByID(datBook.ID) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the book exists"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the book exists."}) } if !exists { - return c.JSON(http.StatusNotFound, models.Message{"The book does not exist"}) + return c.JSON(http.StatusNotFound, models.Message{"The book does not exist."}) } } @@ -68,7 +68,7 @@ func BookAddOrUpdate(c echo.Context) error { // Log the action err = models.LogAction("Added or updated a book", newBook.ID, c) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not log"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not log."}) } return c.JSON(http.StatusOK, newBook) diff --git a/routes/api/v1/books_list.go b/routes/api/v1/books_list.go index ad65d29..1e32982 100644 --- a/routes/api/v1/books_list.go +++ b/routes/api/v1/books_list.go @@ -18,7 +18,7 @@ func BookList(c echo.Context) error { if err != nil { fmt.Println(err) - return c.JSON(http.StatusInternalServerError, models.Message{"Error getting books"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Error getting books."}) } return c.JSON(http.StatusOK, list) diff --git a/routes/api/v1/items_add_update.go b/routes/api/v1/items_add_update.go index 4620560..de07876 100644 --- a/routes/api/v1/items_add_update.go +++ b/routes/api/v1/items_add_update.go @@ -17,7 +17,7 @@ func ItemAddOrUpdate(c echo.Context) error { if itemFromString == "" { if err := c.Bind(&datItem); err != nil { - return c.JSON(http.StatusBadRequest, models.Message{"No item model provided"}) + return c.JSON(http.StatusBadRequest, models.Message{"No item model provided."}) } } else { // Decode the JSON @@ -36,7 +36,7 @@ func ItemAddOrUpdate(c echo.Context) error { itemID, err := strconv.ParseInt(id, 10, 64) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not get item id"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not get item ID."}) } datItem.ID = itemID } @@ -45,11 +45,11 @@ func ItemAddOrUpdate(c echo.Context) error { if datItem.ID != 0 { _, exists, err := models.GetItemByID(datItem.ID) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the item exists"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the item exists."}) } if !exists { - return c.JSON(http.StatusNotFound, models.Message{"The item does not exist"}) + return c.JSON(http.StatusNotFound, models.Message{"The item does not exist."}) } } @@ -63,7 +63,7 @@ func ItemAddOrUpdate(c echo.Context) error { // Log the action err = models.LogAction("Added or updated an item", newItem.ID, c) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not log"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not log."}) } return c.JSON(http.StatusOK, newItem) diff --git a/routes/api/v1/items_delete.go b/routes/api/v1/items_delete.go index ec52041..be9c4df 100644 --- a/routes/api/v1/items_delete.go +++ b/routes/api/v1/items_delete.go @@ -23,7 +23,7 @@ func ItemDelete(c echo.Context) error { _, exists, err := models.GetItemByID(itemID) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not get item"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not get item."}) } if !exists { @@ -34,13 +34,13 @@ func ItemDelete(c echo.Context) error { err = models.DeleteItemByID(itemID) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not delete item"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not delete item."}) } // Log the action err = models.LogAction("Deleted an item", itemID, c) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not log"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not log."}) } return c.JSON(http.StatusOK, models.Message{"success"}) diff --git a/routes/api/v1/items_list.go b/routes/api/v1/items_list.go index fd4b9c5..5b5752b 100644 --- a/routes/api/v1/items_list.go +++ b/routes/api/v1/items_list.go @@ -15,7 +15,7 @@ func ItemsList(c echo.Context) error { list, err := models.ListItems(search) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Error getting items"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Error getting items."}) } return c.JSON(http.StatusOK, list) diff --git a/routes/api/v1/publishers_add_update.go b/routes/api/v1/publishers_add_update.go index c3c85a2..b52ba26 100644 --- a/routes/api/v1/publishers_add_update.go +++ b/routes/api/v1/publishers_add_update.go @@ -18,7 +18,7 @@ func PublisherAddOrUpdate(c echo.Context) error { if publisherFromString == "" { // b := new(models.Publisher) if err := c.Bind(&datPublisher); err != nil { - return c.JSON(http.StatusBadRequest, models.Message{"No publisher model provided"}) + return c.JSON(http.StatusBadRequest, models.Message{"No publisher model provided."}) } } else { // Decode the JSON @@ -37,7 +37,7 @@ func PublisherAddOrUpdate(c echo.Context) error { publisherID, err := strconv.ParseInt(id, 10, 64) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not get item id"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not get item id."}) } datPublisher.ID = publisherID } @@ -46,11 +46,11 @@ func PublisherAddOrUpdate(c echo.Context) error { if datPublisher.ID != 0 { _, exists, err := models.GetPublisherByID(datPublisher.ID) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the publisher exists"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the publisher exists."}) } if !exists { - return c.JSON(http.StatusNotFound, models.Message{"The publisher does not exist"}) + return c.JSON(http.StatusNotFound, models.Message{"The publisher does not exist."}) } } @@ -64,7 +64,7 @@ func PublisherAddOrUpdate(c echo.Context) error { // Log the action err = models.LogAction("Added or updated a publisher", newPublisher.ID, c) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not log"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not log."}) } return c.JSON(http.StatusOK, newPublisher) diff --git a/routes/api/v1/publishers_delete.go b/routes/api/v1/publishers_delete.go index e7e0a91..d6bf241 100644 --- a/routes/api/v1/publishers_delete.go +++ b/routes/api/v1/publishers_delete.go @@ -16,14 +16,14 @@ func PublisherDelete(c echo.Context) error { publisherID, err := strconv.ParseInt(id, 10, 64) if err != nil { - return c.JSON(http.StatusBadRequest, models.Message{"Publisher ID is invalid"}) + return c.JSON(http.StatusBadRequest, models.Message{"Publisher ID is invalid."}) } // Check if the publisher exists _, exists, err := models.GetPublisherByID(publisherID) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not get publisher"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not get publisher."}) } if !exists { @@ -34,13 +34,13 @@ func PublisherDelete(c echo.Context) error { err = models.DeletePublisherByID(publisherID) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not delete publisher"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not delete publisher."}) } // Log the action err = models.LogAction("Deleted a publisher", publisherID, c) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Could not log"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Could not log."}) } return c.JSON(http.StatusOK, models.Message{"success"}) diff --git a/routes/api/v1/publishers_list.go b/routes/api/v1/publishers_list.go index 13ec35b..8d7ef24 100644 --- a/routes/api/v1/publishers_list.go +++ b/routes/api/v1/publishers_list.go @@ -15,7 +15,7 @@ func PublishersList(c echo.Context) error { list, err := models.ListPublishers(search) if err != nil { - return c.JSON(http.StatusInternalServerError, models.Message{"Error getting publishers"}) + return c.JSON(http.StatusInternalServerError, models.Message{"Error getting publishers."}) } return c.JSON(http.StatusOK, list)