removal of python, uses golang testing
This commit is contained in:
@@ -62,12 +62,79 @@ type CreateBudgetRequest struct {
|
||||
CreatedBy string `json:"created_by"`
|
||||
}
|
||||
|
||||
func (cBudget *CreateBudgetRequest) Valid() []string {
|
||||
var errs []string
|
||||
|
||||
if cBudget.FiscalYear < 1 || cBudget.FiscalYear > 2200 {
|
||||
errs = append(errs, "fiscal_year must be between 1 and 2200")
|
||||
}
|
||||
if cBudget.FiscalPeriod < 1 || cBudget.FiscalPeriod > 12 {
|
||||
errs = append(errs, "fiscal_period must be between 1 and 12")
|
||||
}
|
||||
if cBudget.Version == "" {
|
||||
errs = append(errs, "version is required")
|
||||
}
|
||||
if cBudget.DepartmentID == 0 {
|
||||
errs = append(errs, "department_id is required")
|
||||
}
|
||||
if cBudget.GLAccountID == 0 {
|
||||
errs = append(errs, "gl_account_id is required")
|
||||
}
|
||||
if cBudget.Amount <= 0 {
|
||||
errs = append(errs, "amount must be greater than 0")
|
||||
}
|
||||
if cBudget.Currency == "" {
|
||||
errs = append(errs, "currency is required")
|
||||
}
|
||||
if cBudget.CreatedBy == "" {
|
||||
errs = append(errs, "created_by is required")
|
||||
}
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
type UpdateBudgetRequest struct {
|
||||
ID int `json:"id"`
|
||||
Amount float64 `json:"amount"`
|
||||
Notes string `json:"notes"`
|
||||
Version BudgetVersion `json:"version"`
|
||||
ChangedBy string `json:"created_by"`
|
||||
ID int `json:"id"`
|
||||
FiscalYear int `json:"fiscal_year"`
|
||||
FiscalPeriod int `json:"fiscal_period"`
|
||||
Version BudgetVersion `json:"version"`
|
||||
DepartmentID int `json:"department_id"`
|
||||
GLAccountID int `json:"gl_account_id"`
|
||||
Amount float64 `json:"amount"`
|
||||
Currency string `json:"currency"`
|
||||
Notes string `json:"notes"`
|
||||
ChangedBy string `json:"created_by"`
|
||||
}
|
||||
|
||||
func (uBudget *UpdateBudgetRequest) Valid() []string {
|
||||
var errs []string
|
||||
|
||||
if uBudget.FiscalYear < 1 || uBudget.FiscalYear > 2200 {
|
||||
errs = append(errs, "fiscal_year must be between 1 and 2200")
|
||||
}
|
||||
if uBudget.FiscalPeriod < 1 || uBudget.FiscalPeriod > 12 {
|
||||
errs = append(errs, "fiscal_period must be between 1 and 12")
|
||||
}
|
||||
if uBudget.Version == "" {
|
||||
errs = append(errs, "version is required")
|
||||
}
|
||||
if uBudget.DepartmentID == 0 {
|
||||
errs = append(errs, "department_id is required")
|
||||
}
|
||||
if uBudget.GLAccountID == 0 {
|
||||
errs = append(errs, "gl_account_id is required")
|
||||
}
|
||||
if uBudget.Amount <= 0 {
|
||||
errs = append(errs, "amount must be greater than 0")
|
||||
}
|
||||
if uBudget.Currency == "" {
|
||||
errs = append(errs, "currency is required")
|
||||
}
|
||||
if uBudget.ChangedBy == "" {
|
||||
errs = append(errs, "created_by is required")
|
||||
}
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
type Actual struct {
|
||||
@@ -93,6 +160,34 @@ type IngestActualsRequest struct {
|
||||
Source string `json:"source"`
|
||||
}
|
||||
|
||||
func (i *IngestActualsRequest) Valid() []string {
|
||||
var errs []string
|
||||
|
||||
if i.FiscalYear < 1 || i.FiscalYear > 2200 {
|
||||
errs = append(errs, "fiscal_year must be between 1 and 2200")
|
||||
}
|
||||
if i.FiscalPeriod < 1 || i.FiscalPeriod > 12 {
|
||||
errs = append(errs, "fiscal_period must be between 1 and 12")
|
||||
}
|
||||
if i.DeptCode == "" {
|
||||
errs = append(errs, "dept_code is required")
|
||||
}
|
||||
if i.GLCode == "" {
|
||||
errs = append(errs, "gl_code is required")
|
||||
}
|
||||
if i.Amount <= 0 {
|
||||
errs = append(errs, "amount must be greater than 0")
|
||||
}
|
||||
if i.Currency == "" {
|
||||
errs = append(errs, "currency is required")
|
||||
}
|
||||
if i.Source == "" {
|
||||
errs = append(errs, "source is required")
|
||||
}
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
type VarianceStatus string
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user