Adds select actions by plan function
This commit is contained in:
@@ -26,6 +26,16 @@ func (store *postgresStore) SelectActions() ([]*models.Action, error) {
|
||||
return actions, nil
|
||||
}
|
||||
|
||||
func (store *postgresStore) SelectActionsByPlanID(plan *models.Plan) ([]*models.Action, error) {
|
||||
queryString := store.db.Rebind("SELECT action_id, action_description, estimated_chunks, completed_chunks, completed_on, created_at, updated_at, plan_id FROM actions WHERE plan_id = ?")
|
||||
actions := make([]*models.Action, 0)
|
||||
err := store.db.Select(&actions, queryString, plan.PlanID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return actions, nil
|
||||
}
|
||||
|
||||
func (store *postgresStore) SelectActionByID(id int) (*models.Action, error) {
|
||||
action := models.Action{}
|
||||
err := store.db.Get(&action, store.db.Rebind("SELECT action_id, action_description, estimated_chunks, completed_chunks, completed_on, created_at, updated_at, plan_id FROM actions WHERE action_id = ?"), id)
|
||||
|
||||
Reference in New Issue
Block a user