domain

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package domain must be...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stats

type Stats struct {
	HoursToday float64
	HoursWeek  float64
	HoursMonth float64
}

type WorkSession

type WorkSession struct {
	ID           uuid.UUID  `json:"id"`
	ClockInTime  *time.Time `json:"clock_in_time"`
	ClockOutTime *time.Time `json:"clock_out_time,omitempty"`
}

func NewWorkSession

func NewWorkSession() *WorkSession

func (*WorkSession) ClockIn

func (ws *WorkSession) ClockIn(clockIn time.Time)

ClockIn sets the clock in time for the work session

func (*WorkSession) ClockOut

func (ws *WorkSession) ClockOut(clockOut time.Time) error

ClockOut sets the clock out time with validation

func (*WorkSession) Duration

func (ws *WorkSession) Duration() (time.Duration, error)

Duration calculates the duration of the work session If the session is open, it calculates from clock in to now Returns error if there's no clock in time

func (*WorkSession) IsClosed

func (ws *WorkSession) IsClosed() bool

IsClosed returns true if the session has both clock in and clock out

func (*WorkSession) IsOpen

func (ws *WorkSession) IsOpen() bool

IsOpen returns true if the session has clock in but no clock out

type WorkSessionRepository

type WorkSessionRepository interface {
	GetLastSession() (*WorkSession, error)
	Save(*WorkSession) error
	GetByID(id uuid.UUID) (*WorkSession, error)
	GetSessionsByDateRange(start, end time.Time) ([]*WorkSession, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL