Exemplo n.º 1
0
// TagDelete removes a specific tag.
func TagDelete(c *gin.Context) {
	record := session.Tag(c)

	err := store.DeleteTag(
		c,
		record,
	)

	if err != nil {
		logrus.Warnf("Failed to delete tag. %s", err)

		c.JSON(
			http.StatusBadRequest,
			gin.H{
				"status":  http.StatusBadRequest,
				"message": "Failed to delete tag",
			},
		)

		c.Abort()
		return
	}

	c.JSON(
		http.StatusOK,
		gin.H{
			"status":  http.StatusOK,
			"message": "Successfully deleted tag",
		},
	)
}
Exemplo n.º 2
0
// TagShow retrieves a specific tag.
func TagShow(c *gin.Context) {
	record := session.Tag(c)

	c.JSON(
		http.StatusOK,
		record,
	)
}