internal

package
v2.0.0-...-643011e Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nothing            StatusCode = iota
	Success                       = 200
	InvalidRequest                = 400
	NoAuth                        = 401
	Forbidden                     = 403
	RequestTimeout                = 408
	TooManyReq                    = 429
	ServerError                   = 500
	ServiceUnavailable            = 503
)
View Source
const (
	Date = iota
	Code
	Desc
	StartTime
	EndTime
	Hours
	Submit
	Deleted
	Imp
	Unlink
)

Variables

View Source
var ProjCodeToAct map[string]int // same as above
View Source
var ProjCodeToTask map[string]int // This is nil, reference before assignment will cause nil pointer issues

Functions

func DoTaskModify

func DoTaskModify(entry EntryRow, id int)

For modifying an already submitted task.

func DoTaskSubmit

func DoTaskSubmit(entries ...EntryRow) error

For submitting new tasks

func ImportWorklog

func ImportWorklog(db *Database) (int, error)

For the moment the import function will only look for a file

func LoginGetTaskForm

func LoginGetTaskForm(formLogged *bool, username string, pass string) error

func LoginGetTasks

func LoginGetTasks(formLogged *bool) bool

bool to let system know if it should continue with process or prompt user for input

func SetLogger

func SetLogger(l *log.Logger)

Types

type Activity

type Activity struct {
	ActivityID int    `json:"activity_id"`
	ActName    string `json:"name"`
	ParentName string `json:"parent_name"`
	IsActive   bool   `json:"is_active"`
}

func (Activity) Description

func (a Activity) Description() string

func (Activity) FilterValue

func (a Activity) FilterValue() string

func (Activity) Title

func (a Activity) Title() string

type ActivityResp

type ActivityResp struct {
	Status     string      `json:"status"`
	StatusCode int         `json:"statusCode"`
	Messages   interface{} `json:"messages"`
	Data       []Activity  `json:"data"`
}
var ActResp ActivityResp

func (*ActivityResp) ConstructActList

func (a *ActivityResp) ConstructActList() []list.Item

type Auth

type Auth struct {
	Username   string `json:"username"`
	Password   string `json:"password"`
	DeviceName string `json:"device_name"`
	DeviceType string `json:"device_type"`
	DeviceID   string `json:"device_id"`
	Request    struct {
	} `json:"request"`
	CompanyID string `json:"company_account_id"`
	Lang      string `json:"lang"`
}

type AuthResp

type AuthResp struct {
	Status     string      `json:"status"`
	StatusCode int         `json:"statusCode"`
	Messages   interface{} `json:"messages"`
	Data       struct {
		Token    string `json:"token"`
		Settings struct {
			UserID               int    `json:"user_id"`
			MasterCompanyAccount string `json:"master_company_account"`
			FirstDayofWeek       string `json:"first_day_of_week"`
			Timezone             string `json:"timezone"`
			LocaleClock          string `json:"locale_clock"`
			LocaleDate           string `json:"locale_date"`
			LocaleNumber         struct {
				ThousandSeparator string `json:"thousandSeparator"`
				DecimalSeparator  string `json:"decimalSeparator"`
			} `json:"locale_number"`
			CompanyAccounts []CompanyAccounts `json:"company_accounts"`
		} `json:"settings"`
	} `json:"data"`
}
var Authenticate AuthResp

type CompanyAccounts

type CompanyAccounts struct {
	AccountID   string `json:"account_id"`
	AccountName string `json:"account_name"`
}

type Data

type Data struct {
	ActivityID    int    `json:"activity_id"`
	EventID       int    `json:"event_id"`
	EventName     string `json:"event_name"`
	ProjectName   string `json:"project_name"`
	ProjectID     int    `json:"project_id"`
	TimeID        int    `json:"time_entry_id"`
	Desc          string `json:"description"`
	StartDateTime string `json:"start_datetime"`
	Dur           string `json:"duration"`
	Comp          string `json:"completed_datetime"`
}

func (Data) Description

func (d Data) Description() string

func (Data) FilterValue

func (d Data) FilterValue() string

func (Data) String

func (d Data) String() string

func (Data) Title

func (d Data) Title() string

type Database

type Database struct {
	Db *sql.DB
}

func (*Database) AddToActMap

func (d *Database) AddToActMap(projCode string, act list.Item) error

function to map task list resp

func (*Database) AddToTaskMap

func (d *Database) AddToTaskMap(projCode string, item list.Item) error

function to map task list resp

func (*Database) AlterProjTable

func (d *Database) AlterProjTable() error

Check if table has the notes column and add if not

func (*Database) AlterTable

func (d *Database) AlterTable() error

Check if table has the notes column and add if not

func (*Database) CloseDatabase

func (d *Database) CloseDatabase()

func (*Database) CreateDatabase

func (d *Database) CreateDatabase() error

func (*Database) CreateEventDatabase

func (d *Database) CreateEventDatabase() error

func (*Database) DeleteEntry

func (d *Database) DeleteEntry(e int) error
func (d *Database) DeleteLink(projCode string) error

func (*Database) ModifyEntry

func (d *Database) ModifyEntry(e EntryRow) error

func (*Database) OpenDatabase

func (d *Database) OpenDatabase(t *testing.T) error

func (*Database) QueryAndExport

func (d *Database) QueryAndExport() error

func (*Database) QueryEntries

func (d *Database) QueryEntries(id, maxId *int) ([]EntryRow, error)

TODO: fix this to make list construction work better

func (*Database) QueryEntry

func (d *Database) QueryEntry(e EntryRow) (EntryRow, error)
func (d *Database) QueryLinks() (map[string]int, map[string]int, error)

This should be the only function required to read links

func (*Database) QuerySummary

func (d *Database) QuerySummary(start, end *time.Time) ([]EntryRow, error)

func (*Database) SaveAct

func (d *Database) SaveAct(proj string, id int) error

func (*Database) SaveEntry

func (d *Database) SaveEntry(entry EntryRow) error
func (d *Database) SaveLink(proj string, id int) error

func (*Database) SeedDatabase

func (d *Database) SeedDatabase() error

TODO: Seed database for better tests.

type Entry

type Entry struct {
	Hours     time.Duration
	ProjCode  string
	Desc      string
	StartTime time.Time
	EndTime   time.Time
	Date      time.Time
	Notes     string
}

type EntryRow

type EntryRow struct {
	Entry   Entry
	EntryId int
}

func (EntryRow) Description

func (e EntryRow) Description() string

func (*EntryRow) FillData

func (e *EntryRow) FillData(inputs []textinput.Model, textarea *textarea.Model) error

func (EntryRow) FilterValue

func (e EntryRow) FilterValue() string

func (*EntryRow) ModFillData

func (e *EntryRow) ModFillData(inputs []textinput.Model, textarea *textarea.Model) error

func (EntryRow) Title

func (e EntryRow) Title() string

FIXME: Fix the formatting here

type Item

type Item struct {
	// contains filtered or unexported fields
}

Custom items for item

func (Item) Description

func (i Item) Description() string

func (Item) FilterValue

func (i Item) FilterValue() string

func (Item) Title

func (i Item) Title() string

type ModifyResp

type ModifyResp struct {
	Status     string      `json:"status"`
	StatusCode int         `json:"statusCode"`
	Messages   interface{} `json:"messages"`
	Data       Data        `json:"data"`
}

type Request

type Request struct {
	EventID       int    `json:"event_id"`
	Description   string `json:"description"`
	Date          string `json:"time_entry_date"`
	CompDate      string `json:"completed_datetime"`
	CreatedDate   string `json:"submitted_date"`
	Duration      string `json:"duration"`
	StartDateTime string `json:"start_datetime"`
	Completed     bool   `json:"is_completed"`
	Title         string `json:"title"`
	ActivityID    int    `json:"activity_id"`
}

type StatusCode

type StatusCode int

type TaskEntry

type TaskEntry struct {
	Status     string      `json:"status"`
	StatusCode int         `json:"statusCode"`
	Messages   interface{} `json:"messages"`
	Request    Request
}

This should marshal and unmarshal to the Modify API call in Scoro V2 API docs

type TaskListResp

type TaskListResp struct {
	Status     string      `json:"status"`
	StatusCode int         `json:"statusCode"`
	Messages   interface{} `json:"messages"`
	Data       []Data      `json:"data"`
}
var TaskList TaskListResp

func (*TaskListResp) ConstructTaskList

func (d *TaskListResp) ConstructTaskList() []list.Item

func (*TaskListResp) String

func (t *TaskListResp) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳