Documentation ¶
Index ¶
Constants ¶
const ( RouteTimer = "/api/timer" RouteTimerCreate = RouteTimer + "/create" RouteTimerRead = RouteTimer + "/read" RouteTimerUpdate = RouteTimer + "/update" RouteTimerDelete = RouteTimer + "/delete" RouteTimersRead = RouteTimer + "/read" RouteTimerStart = RouteTimer + "/start" RouteTimerPause = RouteTimer + "/pause" RouteTimerSubmit = RouteTimer + "/submit" RouteTimeSlice = "/api/timeslice" RouteTimeSliceRead = RouteTimeSlice + "/read" )
const ( FmtTimeLong = "Jan 2, 2006 at 3:04pm (MST)" FmtTimeShort = "2006-Jan-02" DefaultFolder = ".bludgeon" DefaultConfigurationFile = "config/bludgeon_config.json" DefaultCacheFile = "data/bludgeon_cache.json" )
common constants
const ( ErrBadProjectID string = "projectID is invalid or missing" ErrBadEmployeeID string = "employeeID is invalid or missing" ErrBadTaskID string = "taskID is invalid or missing" ErrBadClientID string = "clientID is invalid or missing" ErrBadTimerID string = "timerID is invalid or missing" ErrBadUnitID string = "unitID is invalid or missing" ErrBadEmployeeIDTaskID string = "employeeID and/or TaskID is invalid or mising" ErrBadClientIDUnitID string = "clientID and/or UnitID is invalid or missing" ErrTimerIsArchivedf string = "timer with id, \"%s\", is archived" ErrNoActiveTimeSlicef string = "timer with id, \"%s\", has no active slice" )
error constants
const ( HeaderTimer string = "TimerID\tTaskID\tEmployeeID\tStart\tFinish\tTimezone\tNote\n" HeaderTask string = "TaskID\tProjectID\tState\tBudget\tDescription\n" HeaderProject string = "Project ID\tUnitID\tClientID\tDescription\n" )
header constants
Variables ¶
This section is empty.
Functions ¶
func GenerateID ¶
Types ¶
type Contract ¶
type Contract struct { ID string `json:"id,omitempty"` StartTime int64 `json:"start_time,string,omitempty"` PauseTime int64 `json:"pause_time,string,omitempty"` FinishTime int64 `json:"finish_time,string,omitempty"` Timer Timer `json:"timer,omitempty"` TimeSlice TimeSlice `json:"time_slice,omitempty"` }
type ObjectType ¶
type ObjectType string
const ( ObjectTypeInvalid ObjectType = "invalid" ObjectTypeTimer ObjectType = "timer" ObjectTypeTimeSlice ObjectType = "timeslice" )
func AtoObjectType ¶
func AtoObjectType(s string) ObjectType
type Project ¶
type Task ¶
type TaskState ¶
type TaskState int
TaskState provides a type to define the state of a task
const ( TaskStateNull TaskState = iota TaskStateUnbilled TaskState = iota //Unbilled is the default state, time has been recorded TaskStateInvoiced TaskState = iota //Invoiced is when the task has been invoiced TaskStatePaid TaskState = iota //Paid is when the task has been paid TaskStateNonBillable TaskState = iota //NonBillable is when the task is non-billable TaskStateInvalid TaskState = iota )
task states
type TimeSlice ¶
type TimeSlice struct { UUID string `json:"UUID"` //a unique identifier for the time slice TimerUUID string `json:"TimerUUID"` //the unique identifier referencing the timer it belongs to Start int64 `json:"Start"` //the start time in unix nano Finish int64 `json:"Finish"` //the finish time in unix nano ElapsedTime int64 `json:"ElapsedTime"` //the elapsed time in nanoeconds Archived bool `json:"Archived"` //whether or not the slice is archived }
TimeSlice is the basic unit of "time", the idea is that a task may span over multiple slices that aren't necessarily contiguous, but can be added together to get an altogether time. This should reduce the overall error when you pause and restart timers (not time slices) from multiple locations time slices can be deleted/archived, but not "edited"
type Timer ¶
type Timer struct { UUID string `json:"UUID"` //unique id to be shared across network ActiveSliceUUID string `json:"ActiveSliceUUID"` //unique id to be shared across network Comment string `json:"Comment"` //a comment describing the timer Start int64 `json:"Start"` //the start time in unix nano Finish int64 `json:"Finish"` //the finish time in unix nano ElapsedTime int64 `json:"ElapsedTime"` //how much time has elapsed Completed bool `json:"Completed"` //this is set to true once the timer has been submitted Archived bool `json:"Archived"` //whether or not the timer is archived Billed bool `json:"Billed"` //this is set once it has been billed so it "can't" be modified EmployeeID int64 `json:"EmployeeID"` }
Timer is a high-level object that describes a single unit of time for a given "task". A timer may be started and paused many times, but only submitted once. Although there's an obvious desire to be able to edit a timer after its submitted, but before it's billed/invoiced. Prior to submission elapsed time should "always" be the sum of all the associated active timers and won't necessarily be the difference between finish and start (but may be if edited post submission).