Documentation
¶
Index ¶
- Constants
- func ValidateProjectForm(ctx context.Context, form types.CreateProjectForm) error
- func ValidateProjectPage(ctx context.Context, query types.GetProjectPageInput) error
- type ArchiveContentDeleter
- type Client
- type PostgresProjectsService
- func (p *PostgresProjectsService) ClientBelongsToProject(ctx context.Context, projectID, clientID string) (bool, error)
- func (p *PostgresProjectsService) CreateOrUpdateProject(ctx context.Context, form types.CreateProjectForm) (Project, error)
- func (p *PostgresProjectsService) CreateProject(ctx context.Context, name string, clients []string) (Project, error)
- func (p *PostgresProjectsService) DeleteProject(ctx context.Context, id, confirmationName string) error
- func (p *PostgresProjectsService) GetProject(ctx context.Context, id string) (Project, error)
- func (p *PostgresProjectsService) GetProjectPage(ctx context.Context, query types.GetProjectPageInput) ([]Project, int64, error)
- func (p *PostgresProjectsService) GetProjects(ctx context.Context) ([]Project, error)
- func (p *PostgresProjectsService) GetProjectsByIds(ctx context.Context, ids []string) ([]Project, error)
- func (p *PostgresProjectsService) ProjectExists(ctx context.Context, projectID, clientID string) bool
- func (p *PostgresProjectsService) SearchProjects(ctx context.Context, request SearchProjectsRequest) ([]Project, error)
- func (p *PostgresProjectsService) SetArchiveStore(store ArchiveContentDeleter)
- func (p *PostgresProjectsService) UpdateProject(ctx context.Context, id uuid.UUID, name string, clients []string) (Project, error)
- type Project
- type ProjectsService
- type SearchProjectsRequest
Constants ¶
View Source
const ( ErrProjectNotFound = "project not found" ErrClientNotFound = "client not found" ErrProjectExists = "project already exists" ErrProjectHasClients = "project has clients; deactivate clients to preserve history" ErrProjectArchiveBusy = "project archive is in progress" ErrProjectDeleteConfirmationRequired = "project deletion requires its exact current name" )
Variables ¶
This section is empty.
Functions ¶
func ValidateProjectForm ¶
func ValidateProjectForm(ctx context.Context, form types.CreateProjectForm) error
func ValidateProjectPage ¶
func ValidateProjectPage(ctx context.Context, query types.GetProjectPageInput) error
Types ¶
type ArchiveContentDeleter ¶
type ArchiveContentDeleter interface {
Backend() string
Delete(ctx context.Context, key string) error
}
ArchiveContentDeleter removes archive files after their rows are gone. Delete is idempotent for missing content and must target only this backend.
type PostgresProjectsService ¶
type PostgresProjectsService struct {
// contains filtered or unexported fields
}
func NewPostgresProjectsService ¶
func NewPostgresProjectsService(pool *pgxpool.Pool) *PostgresProjectsService
func (*PostgresProjectsService) ClientBelongsToProject ¶
func (*PostgresProjectsService) CreateOrUpdateProject ¶
func (p *PostgresProjectsService) CreateOrUpdateProject(ctx context.Context, form types.CreateProjectForm) (Project, error)
func (*PostgresProjectsService) CreateProject ¶
func (*PostgresProjectsService) DeleteProject ¶
func (p *PostgresProjectsService) DeleteProject(ctx context.Context, id, confirmationName string) error
func (*PostgresProjectsService) GetProject ¶
func (*PostgresProjectsService) GetProjectPage ¶
func (p *PostgresProjectsService) GetProjectPage(ctx context.Context, query types.GetProjectPageInput) ([]Project, int64, error)
func (*PostgresProjectsService) GetProjects ¶
func (p *PostgresProjectsService) GetProjects(ctx context.Context) ([]Project, error)
func (*PostgresProjectsService) GetProjectsByIds ¶
func (*PostgresProjectsService) ProjectExists ¶
func (p *PostgresProjectsService) ProjectExists(ctx context.Context, projectID, clientID string) bool
func (*PostgresProjectsService) SearchProjects ¶
func (p *PostgresProjectsService) SearchProjects(ctx context.Context, request SearchProjectsRequest) ([]Project, error)
func (*PostgresProjectsService) SetArchiveStore ¶
func (p *PostgresProjectsService) SetArchiveStore(store ArchiveContentDeleter)
SetArchiveStore wires the store that holds ZIP content. Without it, a project that has archive rows cannot be deleted, because the files would be left behind.
type Project ¶
type Project struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Clients []Client `json:"clients"`
HasRetainedClients bool `json:"hasRetainedClients"`
TotalStorageSize float64 `json:"totalStorageSize"`
}
func (Project) ClientNames ¶
func (*Project) ToCreateProjectForm ¶
func (p *Project) ToCreateProjectForm() types.CreateProjectForm
type ProjectsService ¶
type ProjectsService interface {
CreateProject(ctx context.Context, name string, clients []string) (Project, error)
UpdateProject(ctx context.Context, id uuid.UUID, name string, clients []string) (Project, error)
CreateOrUpdateProject(ctx context.Context, project types.CreateProjectForm) (Project, error)
GetProject(ctx context.Context, id string) (Project, error)
GetProjects(ctx context.Context) ([]Project, error)
GetProjectsByIds(ctx context.Context, ids []string) ([]Project, error)
GetProjectPage(ctx context.Context, query types.GetProjectPageInput) ([]Project, int64, error)
SearchProjects(ctx context.Context, request SearchProjectsRequest) ([]Project, error)
DeleteProject(ctx context.Context, id, confirmationName string) error
ProjectExists(ctx context.Context, projectID, clientID string) bool
ClientBelongsToProject(ctx context.Context, projectID, clientID string) (bool, error)
}
type SearchProjectsRequest ¶
Click to show internal directories.
Click to hide internal directories.