MCPcopy Create free account
hub / github.com/Facets-cloud/flow / ResolveTask

Function ResolveTask

internal/app/resolve.go:17–34  ·  view source on GitHub ↗

---------- exact-match resolvers ---------- All ref resolution is exact match on slug (case-insensitive). ResolveTask resolves a ref to exactly one task by slug. includeArchived controls whether archived rows are eligible.

(db *sql.DB, ref string, includeArchived bool)

Source from the content-addressed store, hash-verified

15// ResolveTask resolves a ref to exactly one task by slug.
16// includeArchived controls whether archived rows are eligible.
17func ResolveTask(db *sql.DB, ref string, includeArchived bool) (*flowdb.Task, error) {
18 ref = strings.TrimSpace(ref)
19 if ref == "" {
20 return nil, fmt.Errorf("empty task ref")
21 }
22
23 t, err := flowdb.GetTask(db, ref)
24 if err != nil {
25 if errors.Is(err, sql.ErrNoRows) {
26 return nil, fmt.Errorf("no task matching %q", ref)
27 }
28 return nil, err
29 }
30 if !includeArchived && t.ArchivedAt.Valid {
31 return nil, fmt.Errorf("task %q is archived", ref)
32 }
33 return t, nil
34}
35
36// ResolveProject resolves a ref to exactly one project by slug.
37func ResolveProject(db *sql.DB, ref string, includeArchived bool) (*flowdb.Project, error) {

Callers 5

findTaskFunction · 0.85
cmdUpdateTaskFunction · 0.85
resolveTaskRefFunction · 0.85
ResolveTaskOrProjectFunction · 0.85

Calls 1

GetTaskFunction · 0.92

Tested by

no test coverage detected