gogmagog/models/action.go
Deepak bbb0cf3f42
All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good
Adds way to check for not found error on id search
2021-01-01 08:07:55 -06:00

29 lines
801 B
Go

package models
import (
"time"
)
// Action represents a single action item.
type Action struct {
ActionID int64 `json:"action_id"`
ActionDescription string `json:"action_description"`
EstimatedChunks int `json:"estimated_chunks"`
CompletedChunks int `json:"completed_chunks"`
CompletedOn time.Time `json:"completed_on"`
PlanID int `json:"plan_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// Actions returns all actions from the model.
func (m *Model) Actions() ([]*Action, error) {
return m.SelectActions()
}
// Action returns a single action from its ID
func (m *Model) Action(id int) (*Action, error) {
act, err := m.SelectActionByID(id)
return act, wrapNotFound(err)
}