client

package
v0.0.0-...-66b7006 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientNameMinLength = 1
	ClientNameMaxLength = 64

	ProjectNameMinLength = 1
	ProjectNameMaxLength = 128
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ClientId     int            `json:"-" db:"client_id"`
	AccountId    int            `json:"-" db:"account_id"`
	ClientName   string         `json:"-" db:"client_name"`
	Address      sql.NullString `json:"-"`
	ClientActive bool           `json:"-" db:"client_active"`
}

type ClientData

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

ProfileData implements database operations for user profiles

func (*ClientData) ArchiveClient

func (c *ClientData) ArchiveClient(clientId int, accountId int) error

func (*ClientData) CopyProjectsFromDateRanges

func (c *ClientData) CopyProjectsFromDateRanges(profileId int, accountId int, fromStart time.Time, fromEnd time.Time, toStart time.Time, toEnd time.Time) (bool, error)

Copy projects and tasks for all the days between prior start and end dates into the new date range

func (*ClientData) CreateClient

func (c *ClientData) CreateClient(newClient Client) (int, error)

func (*ClientData) CreateProject

func (c *ClientData) CreateProject(newProject *Project) (int, error)

func (*ClientData) DeleteClient

func (c *ClientData) DeleteClient(clientId int, accountId int) error

func (*ClientData) DeleteProject

func (c *ClientData) DeleteProject(projectId int, accountId int) error

func (*ClientData) GetAllClients

func (c *ClientData) GetAllClients(accountId int, active bool) ([]*Client, error)

func (*ClientData) GetAllProjects

func (c *ClientData) GetAllProjects(accountId int, active bool) ([]*Project, error)

func (*ClientData) GetClient

func (c *ClientData) GetClient(clientId int, accountId int) (*Client, error)

func (*ClientData) GetProject

func (c *ClientData) GetProject(projectId int, accountId int) (*Project, error)

func (*ClientData) RestoreClient

func (c *ClientData) RestoreClient(clientId int, accountId int) error

func (*ClientData) UpdateClient

func (c *ClientData) UpdateClient(updateData *Client) error

func (*ClientData) UpdateProject

func (c *ClientData) UpdateProject(updateProject *Project) error

func (*ClientData) UpdateProjectActive

func (c *ClientData) UpdateProjectActive(projectId int, accountId int, active bool) error

type ClientRequest

type ClientRequest struct {
	Id      int
	Name    string
	Address string
}

type ClientResource

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

func (*ClientResource) ArchiveClient

func (c *ClientResource) ArchiveClient(clientId int, accountId int) *api.Error

func (*ClientResource) CopyProjectsFromDateRanges

func (c *ClientResource) CopyProjectsFromDateRanges(profileId int, accountId int, fromStart time.Time, fromEnd time.Time, toStart time.Time, toEnd time.Time) ([]*timesheet.TimeEntry, *api.Error)

func (*ClientResource) CreateClient

func (c *ClientResource) CreateClient(accountId int, name string, address string) (*Client, *api.Error)

func (*ClientResource) CreateProject

func (c *ClientResource) CreateProject(newProject *Project) (*Project, *api.Error)

func (*ClientResource) DeleteClient

func (c *ClientResource) DeleteClient(clientId int, accountId int) *api.Error

func (*ClientResource) DeleteProject

func (c *ClientResource) DeleteProject(projectId int, accountId int) *api.Error

func (*ClientResource) GetAllClients

func (c *ClientResource) GetAllClients(accountId int, active bool) ([]*Client, *api.Error)

func (*ClientResource) GetAllProjects

func (c *ClientResource) GetAllProjects(accountId int, active bool) ([]*Project, *api.Error)

func (*ClientResource) GetClient

func (c *ClientResource) GetClient(clientId int, accountId int) (*Client, *api.Error)

func (*ClientResource) GetProject

func (c *ClientResource) GetProject(projectId int, accountId int) (*Project, *api.Error)

func (*ClientResource) RestoreClient

func (c *ClientResource) RestoreClient(clientId int, accountId int) *api.Error

func (*ClientResource) UpdateClient

func (c *ClientResource) UpdateClient(updateClient *Client) *api.Error

func (*ClientResource) UpdateProject

func (c *ClientResource) UpdateProject(updateProject *Project) *api.Error

func (*ClientResource) UpdateProjectActive

func (c *ClientResource) UpdateProjectActive(projectId int, accountId int, active bool) *api.Error

type ClientResponse

type ClientResponse struct {
	ClientId int    `json:"id,omitempty"`
	Name     string `json:"name"`
	Address  string `json:"address,omitempty"`
}

func NewClientResponse

func NewClientResponse(clientData *Client) *ClientResponse

func NewClientsResponse

func NewClientsResponse(clients []*Client) []*ClientResponse

type ClientRouter

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

func NewRouter

func NewRouter(store ClientStore, timeStore timesheet.TimeStore, profileRouter *profile.ProfileRouter) *ClientRouter

Returns a configured authentication profileService

func (*ClientRouter) Router

func (a *ClientRouter) Router() *chi.Mux

type ClientService

type ClientService interface {
	GetClient(clientId int, accountId int) (*Client, *api.Error)
	GetAllClients(accountId int, active bool) ([]*Client, *api.Error)
	GetProject(projectId int, accountId int) (*Project, *api.Error)
	GetAllProjects(accountId int, active bool) ([]*Project, *api.Error)

	CreateClient(accountId int, name string, address string) (*Client, *api.Error)
	CreateProject(newProject *Project) (*Project, *api.Error)
	UpdateClient(updateClient *Client) *api.Error
	UpdateProject(updateProject *Project) *api.Error

	ArchiveClient(clientId int, accountId int) *api.Error
	RestoreClient(clientId int, accountId int) *api.Error
	UpdateProjectActive(projectId int, accountId int, active bool) *api.Error

	DeleteClient(clientId int, accountId int) *api.Error
	DeleteProject(projectId int, accountId int) *api.Error

	CopyProjectsFromDateRanges(profileId int, accountId int, fromStart time.Time, fromEnd time.Time, toStart time.Time, toEnd time.Time) ([]*timesheet.TimeEntry, *api.Error)
}

func NewClientService

func NewClientService(store ClientStore, timeStore timesheet.TimeStore) ClientService

type ClientStore

type ClientStore interface {
	GetClient(clientId int, accountId int) (*Client, error)
	GetAllClients(accountId int, active bool) ([]*Client, error)
	GetProject(projectId int, accountId int) (*Project, error)
	GetAllProjects(accountId int, active bool) ([]*Project, error)

	CreateClient(client Client) (int, error)
	CreateProject(project *Project) (int, error)
	UpdateClient(client *Client) error
	UpdateProject(project *Project) error

	ArchiveClient(clientId int, accountId int) error
	RestoreClient(clientId int, accountId int) error
	UpdateProjectActive(projectId int, accountId int, active bool) error

	DeleteClient(clientId int, accountId int) error
	DeleteProject(projectId int, accountId int) error

	CopyProjectsFromDateRanges(profileId int, accountId int, fromStart time.Time, fromEnd time.Time, toStart time.Time, toEnd time.Time) (bool, error)
}

func NewClientStore

func NewClientStore(db *sqlx.DB) ClientStore

type Project

type Project struct {
	Client
	ProjectId     int                `json:"-" db:"project_id"`
	ProjectName   string             `json:"-" db:"project_name"`
	Code          sql.NullString     `json:"-"`
	ProjectActive bool               `json:"-" db:"project_active"`
	Tasks         []task.ProjectTask `json:"-"`
}

type ProjectContainerRequest

type ProjectContainerRequest struct {
	Id       int
	ClientId int
	Name     string
	Tasks    []TaskRequest
}

type ProjectIdRequest

type ProjectIdRequest struct {
	ProjectId int
}

type ProjectRequest

type ProjectRequest struct {
	Id       int
	ClientId int
	Name     string
}

type ProjectResponse

type ProjectResponse struct {
	ProjectId     int                   `json:"id,omitempty"`
	ProjectName   string                `json:"name"`
	ProjectActive bool                  `json:"active"`
	ClientId      int                   `json:"clientId,omitempty"`
	Code          string                `json:"code,omitempty"`
	ClientName    string                `json:"clientName,omitempty"`
	Tasks         []ProjectTaskResponse `json:"tasks,omitempty"`
}

func NewProjectResponse

func NewProjectResponse(project *Project) *ProjectResponse

func NewProjectsResponse

func NewProjectsResponse(projects []*Project) []*ProjectResponse

type ProjectTaskEntry

type ProjectTaskEntry struct {
	ProjectId int `json:"-" db:"project_id"`
	TaskId    int `json:"-" db:"task_id"`
}

type ProjectTaskResponse

type ProjectTaskResponse struct {
	TaskId   int     `json:"id"`
	Name     string  `json:"name"`
	Rate     float64 `json:"rate,omitempty"`
	Billable bool    `json:"billable"`
	Active   bool    `json:"active"`
}

func NewProjectTaskResponse

func NewProjectTaskResponse(t *task.ProjectTask) ProjectTaskResponse

type StartAndEndDateRequest

type StartAndEndDateRequest struct {
	StartDate string
	EndDate   string
}

type TaskRequest

type TaskRequest struct {
	Id       int
	Billable bool
	Rate     float64
}

Jump to

Keyboard shortcuts

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