mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
add delete snapshoot if change chickin date
This commit is contained in:
@@ -2127,7 +2127,7 @@ func (s chickinService) UpdateChickInDate(ctx *fiber.Ctx, req *validation.Update
|
|||||||
return fiber.NewError(fiber.StatusNotFound, "Project flock kandang tidak ditemukan")
|
return fiber.NewError(fiber.StatusNotFound, "Project flock kandang tidak ditemukan")
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.Repository.DB().WithContext(ctx.Context()).Transaction(func(tx *gorm.DB) error {
|
if err := s.Repository.DB().WithContext(ctx.Context()).Transaction(func(tx *gorm.DB) error {
|
||||||
if err := s.Repository.UpdateChickInDateByProjectFlockKandangID(ctx.Context(), tx, req.ProjectFlockKandangId, newDate); err != nil {
|
if err := s.Repository.UpdateChickInDateByProjectFlockKandangID(ctx.Context(), tx, req.ProjectFlockKandangId, newDate); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -2139,5 +2139,10 @@ func (s chickinService) UpdateChickInDate(ctx *fiber.Ctx, req *validation.Update
|
|||||||
WHERE project_flock_kandangs_id = ?
|
WHERE project_flock_kandangs_id = ?
|
||||||
AND deleted_at IS NULL
|
AND deleted_at IS NULL
|
||||||
`, req.ChickInDate, req.ProjectFlockKandangId).Error
|
`, req.ChickInDate, req.ProjectFlockKandangId).Error
|
||||||
})
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
s.invalidateDepreciationSnapshots(ctx.Context(), nil, []uint{req.ProjectFlockKandangId}, newDate)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user