feat: update image upload and preview
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
9c51a0fb7b
commit
154bc12287
|
|
@ -110,13 +110,14 @@ func (_i *popupNewsContentsController) Save(c *fiber.Ctx) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err := _i.service.Save(*req)
|
data, err := _i.service.Save(*req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return utilRes.Resp(c, utilRes.Response{
|
return utilRes.Resp(c, utilRes.Response{
|
||||||
Messages: utilRes.Messages{"Popup news content successfully created"},
|
Messages: utilRes.Messages{"Popup news content successfully created"},
|
||||||
|
Data: data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ type popupNewsContentsService struct {
|
||||||
type PopupNewsContentsService interface {
|
type PopupNewsContentsService interface {
|
||||||
All(req request.PopupNewsContentsQueryRequest) (data []*response.PopupNewsContentsResponse, paging paginator.Pagination, err error)
|
All(req request.PopupNewsContentsQueryRequest) (data []*response.PopupNewsContentsResponse, paging paginator.Pagination, err error)
|
||||||
Show(id uint) (*response.PopupNewsContentsResponse, error)
|
Show(id uint) (*response.PopupNewsContentsResponse, error)
|
||||||
Save(req request.PopupNewsContentsCreateRequest) error
|
Save(req request.PopupNewsContentsCreateRequest) (*response.PopupNewsContentsResponse, error)
|
||||||
Update(id uint, req request.PopupNewsContentsUpdateRequest) error
|
Update(id uint, req request.PopupNewsContentsUpdateRequest) error
|
||||||
Delete(id uint) error
|
Delete(id uint) error
|
||||||
}
|
}
|
||||||
|
|
@ -58,10 +58,14 @@ func (_i *popupNewsContentsService) Show(id uint) (*response.PopupNewsContentsRe
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
func (_i *popupNewsContentsService) Save(req request.PopupNewsContentsCreateRequest) error {
|
func (_i *popupNewsContentsService) Save(req request.PopupNewsContentsCreateRequest) (*response.PopupNewsContentsResponse, error) {
|
||||||
_i.Log.Info().Interface("data", req).Msg("create popup news content")
|
_i.Log.Info().Interface("data", req).Msg("create popup news content")
|
||||||
|
|
||||||
return _i.Repo.Create(req.ToEntity())
|
ent := req.ToEntity()
|
||||||
|
if err := _i.Repo.Create(ent); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return mapper.PopupNewsContentsResponseMapper(ent), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue