Fix mini-slider admin CRUD JSON encoding and drop seed data from the migration.
Encode title as JSON text so create/list work with pgx, and keep the table migration permission-free so rows are added from admin. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -54,6 +54,7 @@ func (h *handler) Register(router *gin.RouterGroup) {
|
||||
func (h *handler) GetAll(c *gin.Context) {
|
||||
result, err := h.repository.GetAllData(context.Background(), listing.FromQuery(c))
|
||||
if err != nil {
|
||||
h.logger.Error("get all mini slider :::", err)
|
||||
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||
return
|
||||
}
|
||||
@@ -107,6 +108,7 @@ func (h *handler) Create(c *gin.Context) {
|
||||
|
||||
res, err := h.repository.AddData(context.Background(), reqDTO)
|
||||
if err != nil {
|
||||
h.logger.Error("create mini slider :::", err)
|
||||
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||
return
|
||||
}
|
||||
@@ -141,6 +143,7 @@ func (h *handler) Update(c *gin.Context) {
|
||||
|
||||
res, err := h.repository.UpdateData(context.Background(), reqDTO, id)
|
||||
if err != nil {
|
||||
h.logger.Error("update mini slider :::", err)
|
||||
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user