From afb8cb9773ff87bdf3505672aca68d80c5b05239 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Sun, 10 Nov 2024 08:23:28 +0200 Subject: [PATCH] Change types.Message to contain Info field and not Message field --- handlers/income.go | 2 +- handlers/ping.go | 2 +- handlers/user_scope_CRUD.go | 4 ++-- types/types.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/handlers/income.go b/handlers/income.go index 3ee9b90..44b94b0 100644 --- a/handlers/income.go +++ b/handlers/income.go @@ -130,7 +130,7 @@ func IncomeAdd(c *gin.Context) { return } 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) } diff --git a/handlers/ping.go b/handlers/ping.go index 2ec0b46..33e94ee 100644 --- a/handlers/ping.go +++ b/handlers/ping.go @@ -13,5 +13,5 @@ import ( // @Success 200 {object} types.Message // @Router /ping [get] func PingGet(c *gin.Context) { - c.JSON(200, types.Message{Message: "Pong!"}) + c.JSON(200, types.Message{Info: "Pong!"}) } diff --git a/handlers/user_scope_CRUD.go b/handlers/user_scope_CRUD.go index a7b7801..9ffd3f8 100644 --- a/handlers/user_scope_CRUD.go +++ b/handlers/user_scope_CRUD.go @@ -70,7 +70,7 @@ func CreateHandler[T db.UserIdentifiable, R any](entity T, applyChanges func(src 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 } - 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())}) } } diff --git a/types/types.go b/types/types.go index 10e29ae..56f26ea 100644 --- a/types/types.go +++ b/types/types.go @@ -16,7 +16,7 @@ type Account struct { } type Message struct { - Message string `json:"message" example:"Success!"` + Info string `json:"info" example:"Success!"` } type ErrorResponse struct {