fix(delete): update delete operations to return affected rows for cabinets, rooms, and warehouses
This commit is contained in:
@@ -165,13 +165,14 @@ func WareHouseDelete(c *gin.Context) error {
|
||||
rowsAffected, err := repositories.DeleteWarehouse(c.Request.Context(), global.Queries, id)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("Failed to delete warehouse with ID: %d", id)
|
||||
if rowsAffected == 0 {
|
||||
response.NotFoundError(c, http.StatusNotFound, "Warehouse not found")
|
||||
return nil
|
||||
}
|
||||
|
||||
response.InternalServerError(c, http.StatusInternalServerError, "Failed to delete warehouse")
|
||||
return nil
|
||||
}
|
||||
if rowsAffected == 0 {
|
||||
response.NotFoundError(c, http.StatusNotFound, "Warehouse not found")
|
||||
return nil
|
||||
}
|
||||
response.Ok(c, "Delete Success", nil)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user