summaryrefslogtreecommitdiff
path: root/internal/actions
diff options
context:
space:
mode:
Diffstat (limited to 'internal/actions')
-rw-r--r--internal/actions/actions.go1
-rw-r--r--internal/actions/timer.go14
2 files changed, 14 insertions, 1 deletions
diff --git a/internal/actions/actions.go b/internal/actions/actions.go
index 727b474..d3e1460 100644
--- a/internal/actions/actions.go
+++ b/internal/actions/actions.go
@@ -12,6 +12,7 @@ type Actions interface {
PunchIn(ctx context.Context, client, project, description string, billableRate *float64) (*TimerSession, error)
PunchInMostRecent(ctx context.Context, description string, billableRate *float64) (*TimerSession, error)
PunchOut(ctx context.Context) (*TimerSession, error)
+ EditEntry(ctx context.Context, entry queries.TimeEntry) error
// Client operations
CreateClient(ctx context.Context, name, email string, billableRate *float64) (*queries.Client, error)
diff --git a/internal/actions/timer.go b/internal/actions/timer.go
index 5235a0a..9f29c51 100644
--- a/internal/actions/timer.go
+++ b/internal/actions/timer.go
@@ -58,7 +58,7 @@ func (a *actions) PunchIn(ctx context.Context, client, project, description stri
// Verify project belongs to client if both specified
if resolvedProject != nil && resolvedProject.ClientID != clientID {
- return nil, fmt.Errorf("%w: project %q does not belong to client %q",
+ return nil, fmt.Errorf("%w: project %q does not belong to client %q",
ErrProjectClientMismatch, project, client)
}
} else if resolvedProject != nil {
@@ -262,6 +262,18 @@ func (a *actions) PunchOut(ctx context.Context) (*TimerSession, error) {
}, nil
}
+func (a *actions) EditEntry(ctx context.Context, entry queries.TimeEntry) error {
+ return a.queries.EditTimeEntry(ctx, queries.EditTimeEntryParams{
+ StartTime: entry.StartTime,
+ EndTime: entry.EndTime,
+ Description: entry.Description,
+ ClientID: entry.ClientID,
+ ProjectID: entry.ProjectID,
+ HourlyRate: entry.BillableRate,
+ EntryID: entry.ID,
+ })
+}
+
// Helper functions
func (a *actions) createTimeEntry(ctx context.Context, clientID int64, projectID sql.NullInt64, description string, billableRate *float64) (*queries.TimeEntry, error) {