Documentation
¶
Overview ¶
Package models defines the core data structures used throughout timetraced. It includes types representing users, projects, and records, along with supporting types such as report requests. These structs form the shared domain model for persistence, business logic, and presentation layers, and are serialized for storage and communication between packages.
Index ¶
- func FmtDuration(d time.Duration) string
- func IsTrackingActive(u string) bool
- func Tracked(u string) string
- func TrackingActive(u string, p Project)
- func TrackingInactive(u string)
- func Version()
- type Config
- type DatabaseReportRequest
- type Duration
- type EditRecord
- type Editor
- type Page
- type Project
- type Record
- type Report
- type ReportRecord
- type ReportRequest
- type StartRequest
- type Status
- type StatusResponse
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FmtDuration ¶
FmtDuration returns a human readable representation of a duration in hours:minute and decimal hours format.
func IsTrackingActive ¶
IsTrackingActive checks if tracking has been activated for given user.
func TrackingActive ¶
TrackingActive activates tracking for given user and project.
func TrackingInactive ¶
func TrackingInactive(u string)
TrackingInactive deactivates tracking for given user.
Types ¶
type Config ¶
type Config struct {
Theme string `form:"theme" json:"theme"`
Font string `form:"font" json:"font"`
Refresh int `form:"refresh" json:"refresh"`
}
Config represents the user selectable UI options.
type DatabaseReportRequest ¶
DatabaseReportRequest represents a ReportRequest formatted for db queries.
type EditRecord ¶
EditRecord represents a time record for editing in UI.
type Page ¶
type Page struct {
Version string
Tracking bool
Projects []string
Status StatusResponse
DefaultDate string
}
Page represents the data to for display to user.
type Report ¶
type Report struct {
Project string
Total string
Items []ReportRecord
}
Report represents the time spent on a project. It is a response to a ReportRequest.
type ReportRecord ¶
ReportRecord represents and individual report record.
type ReportRequest ¶
type ReportRequest struct {
Start string `form:"start" json:"start"`
End string `form:"end" json:"end"`
Project string `form:"project" json:"project"`
}
ReportRequest contains data to initiate a report.
type StartRequest ¶
type StartRequest struct {
Project string
}
StartRequest is a request to start recording time for a given project.
type Status ¶
type Status struct {
Current string
Elapsed time.Duration
Total time.Duration
DailyTotal time.Duration
}
Status represents the time recorded today.