Feat[BE]: refactor expense API and expense table match with new ERD

This commit is contained in:
aguhh18
2025-11-27 13:53:35 +07:00
parent 99688c8e11
commit 886446b55f
10 changed files with 278 additions and 169 deletions
@@ -155,6 +155,18 @@ func (u *ExpenseController) UpdateOne(c *fiber.Ctx) error {
req.TransactionDate = &transactionDate
}
categoryVal := c.FormValue("category")
req.Category = &categoryVal
supplierIDVal := c.FormValue("supplier_id")
if supplierIDVal != "" {
supplierID, err := strconv.ParseUint(supplierIDVal, 10, 64)
if err != nil {
return fiber.NewError(fiber.StatusBadRequest, "Invalid supplier_id format")
}
req.SupplierID = &supplierID
}
costPerKandangJSON := c.FormValue("cost_per_kandang")
if costPerKandangJSON != "" {
var costPerKandang []validation.CostPerKandang