1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package commands
import (
"context"
"errors"
"punchcard/internal/actions"
"punchcard/internal/queries"
)
// ErrNoActiveTimer is returned when trying to punch out but no timer is active
var ErrNoActiveTimer = errors.New("no active timer found")
// Helper functions for commands that need to find clients/projects
// These wrap the actions package for backward compatibility
func findClient(ctx context.Context, q *queries.Queries, clientRef string) (queries.Client, error) {
a := actions.New(q)
client, err := a.FindClient(ctx, clientRef)
if err != nil {
return queries.Client{}, err
}
return *client, nil
}
func findProject(ctx context.Context, q *queries.Queries, projectRef string) (queries.Project, error) {
a := actions.New(q)
project, err := a.FindProject(ctx, projectRef)
if err != nil {
return queries.Project{}, err
}
return *project, nil
}
|