Change types.Message to contain Info field and not Message field

This commit is contained in:
qowevisa 2024-11-10 08:23:28 +02:00
parent 88981b8141
commit afb8cb9773
4 changed files with 5 additions and 5 deletions

View File

@ -130,7 +130,7 @@ func IncomeAdd(c *gin.Context) {
return return
} }
msg := types.Message{ msg := types.Message{
Message: fmt.Sprintf("Income with id %d was successfully created!", dbIncome.ID), Info: fmt.Sprintf("Income with id %d was successfully created!", dbIncome.ID),
} }
c.JSON(200, msg) c.JSON(200, msg)
} }

View File

@ -13,5 +13,5 @@ import (
// @Success 200 {object} types.Message // @Success 200 {object} types.Message
// @Router /ping [get] // @Router /ping [get]
func PingGet(c *gin.Context) { func PingGet(c *gin.Context) {
c.JSON(200, types.Message{Message: "Pong!"}) c.JSON(200, types.Message{Info: "Pong!"})
} }

View File

@ -70,7 +70,7 @@ func CreateHandler[T db.UserIdentifiable, R any](entity T, applyChanges func(src
return return
} }
c.JSON(200, types.Message{Message: fmt.Sprintf("Entity created with ID %d", entity.GetID())}) c.JSON(200, types.Message{Info: fmt.Sprintf("Entity created with ID %d", entity.GetID())})
} }
} }
@ -166,6 +166,6 @@ func DeleteHandler[T db.UserIdentifiable]() gin.HandlerFunc {
return return
} }
c.JSON(200, types.Message{Message: fmt.Sprintf("Entity with ID %d deleted", entity.GetID())}) c.JSON(200, types.Message{Info: fmt.Sprintf("Entity with ID %d deleted", entity.GetID())})
} }
} }

View File

@ -16,7 +16,7 @@ type Account struct {
} }
type Message struct { type Message struct {
Message string `json:"message" example:"Success!"` Info string `json:"info" example:"Success!"`
} }
type ErrorResponse struct { type ErrorResponse struct {