data

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: MPL-2.0 Imports: 4 Imported by: 7

Documentation

Index

Constants

View Source
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"
)
View Source
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

View Source
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

View Source
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

func GenerateID() (string, error)

Types

type CacheData

type CacheData struct {
}

type Client

type Client struct {
	ID   int64  `json:"ClientID,omitempty"`
	Name string `json:"Name,omitempty"`
}

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 Employee

type Employee struct {
	ID        int64  `json:"EmployeeID,omitempty"`
	FirstName string `json:"FirstName,omitempty"`
	LastName  string `json:"LastName,omitempty"`
}

type ObjectType

type ObjectType string
const (
	ObjectTypeInvalid   ObjectType = "invalid"
	ObjectTypeTimer     ObjectType = "timer"
	ObjectTypeTimeSlice ObjectType = "timeslice"
)

func AtoObjectType

func AtoObjectType(s string) ObjectType

type Options

type Options struct {
	EmployeeID int64  `json:"EmployeeID,omitempty"`
	ClientID   int64  `json:"ClientID,omitempty"`
	TimerID    int64  `json:"TimerID,omitempty"`
	ProjectID  int64  `json:"ProjectID,omitempty"`
	Token      string `json:"TokenID,omitempty"`
}

type Project

type Project struct {
	ID          int64  `json:"ProjectID,omitempty"`
	ClientID    int64  `json:"ClientId,omitempty"`
	Description string `json:"Descrition,omitempty"`
}

func (*Project) String

func (p *Project) String() string

type Task

type Task struct {
	ID          int64     `json:"TaskID,omitempty"`
	ProjectID   int64     `json:"ProjectID,omitempty"`
	Description string    `json:"Description,omitempty"`
	State       TaskState `json:"State,omitempty"`
	Budget      int64     `json:"Budget,omitempty"`
}

func (*Task) String

func (t *Task) String() string

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

func (TaskState) String

func (t TaskState) String() string

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).

func (Timer) String

func (t Timer) String() string

type Token

type Token struct {
	Token string
	Time  int64
}

Token provides a way to store token information

Jump to

Keyboard shortcuts

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