FIX[BE]: if project flocs deleted kandangs reset to non_active and add filter get all project_flock by area,kandangs,period and location

This commit is contained in:
ragilap
2025-10-19 23:24:56 +07:00
parent c9b4b3008e
commit f15e0d62e3
13 changed files with 663 additions and 51 deletions
@@ -42,6 +42,7 @@ func setupIntegrationApp(t *testing.T) (*fiber.App, *gorm.DB) {
&entities.Location{},
&entities.Flock{},
&entities.ProjectFlock{},
&entities.ProjectFlockKandang{},
&entities.Kandang{},
&entities.Warehouse{},
&entities.Uom{},
@@ -191,6 +192,15 @@ func fetchCustomer(t *testing.T, db *gorm.DB, id uint) entities.Customer {
return customer
}
func fetchKandang(t *testing.T, db *gorm.DB, id uint) entities.Kandang {
t.Helper()
var kandang entities.Kandang
if err := db.Preload("ProjectFlock").First(&kandang, id).Error; err != nil {
t.Fatalf("failed to fetch kandang: %v", err)
}
return kandang
}
func createSupplier(t *testing.T, app *fiber.App, name, alias, category string) uint {
t.Helper()
identifier := strings.ToLower(strings.ReplaceAll(name, " ", "_"))