diff --git a/features/pm/kpi_c_title/controller.go b/features/pm/kpi_c_title/controller.go index c9551bfb..1c509470 100644 --- a/features/pm/kpi_c_title/controller.go +++ b/features/pm/kpi_c_title/controller.go @@ -10,15 +10,6 @@ import ( "github.com/gin-gonic/gin" ) -const ( - CodeKeyName = "code" - MsgKeyName = "message" - DataKeyName = "data" - CodeError = 0 - CodeSuccess = 1 - TotalKeyName = "total" -) - func (k *KpiCTitle) GetToalList(c *gin.Context) { var titles []KpiCTitle var conditions []string @@ -148,7 +139,7 @@ func (k *KpiCTitle) Put(c *gin.Context) { id := c.Param("id") if err := datasource.DefaultDB().First(&title, id).Error; err != nil { - c.JSON(http.StatusNotFound, services.ErrResp("Title not found")) + c.JSON(http.StatusNotFound, services.ErrResp("KPIC Title not found")) return } @@ -157,14 +148,15 @@ func (k *KpiCTitle) Put(c *gin.Context) { return } datasource.DefaultDB().Save(&title) - c.JSON(http.StatusOK, title) + + c.JSON(http.StatusOK, services.DataResp(title)) } func (k *KpiCTitle) Delete(c *gin.Context) { id := c.Param("id") if err := datasource.DefaultDB().Delete(&KpiCTitle{}, id).Error; err != nil { - c.JSON(http.StatusNotFound, services.ErrResp("Title not found")) + c.JSON(http.StatusNotFound, services.ErrResp("KPIC Title not found")) return } diff --git a/features/pm/kpi_c_title/model.go b/features/pm/kpi_c_title/model.go index f2e804ed..1bfbfcbc 100644 --- a/features/pm/kpi_c_title/model.go +++ b/features/pm/kpi_c_title/model.go @@ -9,6 +9,7 @@ type KpiCTitle struct { Title *string `gorm:"column:title;default:NULL," json:"title,omitempty"` Expression *string `gorm:"column:expression;default:NULL," json:"expression,omitempty"` Status *string `gorm:"column:status" json:"status,omitempty"` + Unit *string `gorm:"column:unit" json:"unit,omitempty"` Description *string `gorm:"column:description;default:NULL," json:"description,omitempty"` CreatedBy *string `gorm:"column:created_by;default:NULL," json:"createdBy,omitempty"` UpdatedAt *time.Time `gorm:"column:updated_at;default:current_timestamp()," json:"updatedAt,omitempty"`