Add Plan page with day planner
This commit is contained in:
53
backend/dashapi/model_plan_day.go
Normal file
53
backend/dashapi/model_plan_day.go
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Dash API
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 0.1
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package dashapi
|
||||
|
||||
type PlanDay struct {
|
||||
|
||||
Date string `json:"date"`
|
||||
|
||||
Morning []string `json:"morning,omitempty"`
|
||||
|
||||
Midday []string `json:"midday,omitempty"`
|
||||
|
||||
Afternoon []string `json:"afternoon,omitempty"`
|
||||
|
||||
Evening []string `json:"evening,omitempty"`
|
||||
|
||||
Pleasant []string `json:"pleasant,omitempty"`
|
||||
|
||||
Reminders []string `json:"reminders,omitempty"`
|
||||
}
|
||||
|
||||
// AssertPlanDayRequired checks if the required fields are not zero-ed
|
||||
func AssertPlanDayRequired(obj PlanDay) error {
|
||||
elements := map[string]interface{}{
|
||||
"date": obj.Date,
|
||||
}
|
||||
for name, el := range elements {
|
||||
if isZero := IsZeroValue(el); isZero {
|
||||
return &RequiredError{Field: name}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AssertRecursePlanDayRequired recursively checks if required fields are not zero-ed in a nested slice.
|
||||
// Accepts only nested slice of PlanDay (e.g. [][]PlanDay), otherwise ErrTypeAssertionError is thrown.
|
||||
func AssertRecursePlanDayRequired(objSlice interface{}) error {
|
||||
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
|
||||
aPlanDay, ok := obj.(PlanDay)
|
||||
if !ok {
|
||||
return ErrTypeAssertionError
|
||||
}
|
||||
return AssertPlanDayRequired(aPlanDay)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user