Refactor[BE]: refactor expense category handling to use constants for BOP and NON-BOP

This commit is contained in:
aguhh18
2025-12-18 15:03:37 +07:00
parent 9e0b4be4dd
commit c95f90f0b9
2 changed files with 27 additions and 8 deletions
+19
View File
@@ -135,6 +135,17 @@ const (
SupplierCategorySapronak SupplierCategory = "SAPRONAK"
)
// -------------------------------------------------------------------
// ExpenseCategory
// -------------------------------------------------------------------
type ExpenseCategory string
const (
ExpenseCategoryBOP ExpenseCategory = "BOP"
ExpenseCategoryNonBOP ExpenseCategory = "NON-BOP"
)
// -------------------------------------------------------------------
// Kandang Status
// -------------------------------------------------------------------
@@ -429,6 +440,14 @@ func IsValidSupplierCategory(v string) bool {
return false
}
func IsValidExpenseCategory(v string) bool {
switch ExpenseCategory(v) {
case ExpenseCategoryBOP, ExpenseCategoryNonBOP:
return true
}
return false
}
// example use
// Recording helper