Documentation
¶
Overview ¶
Package domain must be...
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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)
}
Click to show internal directories.
Click to hide internal directories.