go-kimai/models/task_edit_form.go
2023-01-14 22:44:16 +01:00

145 lines
3.0 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// TaskEditForm task edit form
//
// swagger:model TaskEditForm
type TaskEditForm struct {
// Activity ID
// Required: true
Activity *int64 `json:"activity"`
// description
Description string `json:"description,omitempty"`
// end
// Example: 2023-01-14T05:12:43
// Format: date-time
End strfmt.DateTime `json:"end,omitempty"`
// Estimation in seconds
Estimation int64 `json:"estimation,omitempty"`
// Project ID
// Required: true
Project *int64 `json:"project"`
// Comma separated list of tags
Tags string `json:"tags,omitempty"`
// Team ID
Team int64 `json:"team,omitempty"`
// title
// Required: true
Title *string `json:"title"`
// The actual doings, which will be available on the detail and edit page.
Todo string `json:"todo,omitempty"`
// User ID
User int64 `json:"user,omitempty"`
}
// Validate validates this task edit form
func (m *TaskEditForm) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateActivity(formats); err != nil {
res = append(res, err)
}
if err := m.validateEnd(formats); err != nil {
res = append(res, err)
}
if err := m.validateProject(formats); err != nil {
res = append(res, err)
}
if err := m.validateTitle(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *TaskEditForm) validateActivity(formats strfmt.Registry) error {
if err := validate.Required("activity", "body", m.Activity); err != nil {
return err
}
return nil
}
func (m *TaskEditForm) validateEnd(formats strfmt.Registry) error {
if swag.IsZero(m.End) { // not required
return nil
}
if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil {
return err
}
return nil
}
func (m *TaskEditForm) validateProject(formats strfmt.Registry) error {
if err := validate.Required("project", "body", m.Project); err != nil {
return err
}
return nil
}
func (m *TaskEditForm) validateTitle(formats strfmt.Registry) error {
if err := validate.Required("title", "body", m.Title); err != nil {
return err
}
return nil
}
// ContextValidate validates this task edit form based on context it is used
func (m *TaskEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *TaskEditForm) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TaskEditForm) UnmarshalBinary(b []byte) error {
var res TaskEditForm
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}