services

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmailAlreadyInUse = errors.New("email or username already in use")
)
View Source
var ErrInvalidCredentials = errors.New("invalid email and password combination provided")
View Source
var ErrNotFound = errors.New("entity or resource not found")
View Source
var ErrUserAlreadyExists = errors.New("user with given email already exists")

Functions

func GenerateNextCode added in v0.0.2

func GenerateNextCode(ctx context.Context, db *dbsqlc.Queries, projectID int64, project *dbsqlc.Project, userCode *string) (string, error)

Types

type AuthService

type AuthService interface {
	SignIn(*schema.LoginRequest) (*schema.LoginResponse, error)
	SignUp(*schema.SignUpRequest) (*schema.LoginResponse, error)
	ResetPassword(ctx context.Context, email string) error
	ChangePassword(ctx context.Context, request *schema.ChangePasswordRequest) error
}

func NewAuthService

func NewAuthService(authConfig *config.AuthConfiguration, db *dbsqlc.Queries, logger logging.Logger) AuthService

type DashboardService added in v0.0.2

type DashboardService interface {
	GetDashboardSummary(ctx context.Context) (*schema.DashboardSummaryResponse, error)
}

func NewDashboardService added in v0.0.2

func NewDashboardService(queries *dbsqlc.Queries, logger logging.Logger) DashboardService

type GitHubIntegration

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

func NewGitHubIntegration

func NewGitHubIntegration(client *github.Client, projectService ProjectService, testCaseService TestCaseService) *GitHubIntegration

NewGitHubIntegration creates a new github integration which requires a fully constructed AND authenticated GitHub client to work if the client is not authorized to make requests, then all functionality in this type may not work and will return errors

func (*GitHubIntegration) CreateTestCasesFromOpenIssues

func (g *GitHubIntegration) CreateTestCasesFromOpenIssues(ctx context.Context, owner, repo string, projectID int64) ([]dbsqlc.TestCase, error)

func (*GitHubIntegration) FetchProjects

func (g *GitHubIntegration) FetchProjects(ctx context.Context) ([]string, error)

func (*GitHubIntegration) ListIssues

func (g *GitHubIntegration) ListIssues(ctx context.Context, project string) ([]any, error)

type ModuleService added in v0.0.2

type ModuleService interface {
	Create(
		*schema.CreateProjectModuleRequest,
	) (bool, error)
	// GetOne retrieves one module in the context
	GetOne(ctx context.Context, id int32) (dbsqlc.Module, error)
	// GetAll retrieves all modules in the context
	GetAll(ctx context.Context) ([]dbsqlc.Module, error)
	// Update used to edit module records
	Update(ctx context.Context, request schema.UpdateProjectModuleRequest) (bool, error)
	// Delete used to delete a module from table
	Delete(ctx context.Context, id int32) error
	// GetProjectModules retrieves all modules in database which belong to one project
	GetProjectModules(ctx context.Context, projectID int32) ([]dbsqlc.Module, error)
}

func NewModuleService added in v0.0.2

func NewModuleService(queries *dbsqlc.Queries) ModuleService

type OrganizationUserService

type OrganizationUserService interface {
	// FindAll finds all users in a given organization
	FindAll(context.Context, int64) ([]dbsqlc.User, error)
}

type PageService added in v0.0.2

type PageService interface {
	Create(context.Context, *schema.PageRequest) (bool, error)
	GetOnePage(ctx context.Context, id int32) (dbsqlc.Page, error)
	GetAllPages(ctx context.Context) ([]dbsqlc.Page, error)
	UpdatePage(ctx context.Context, request schema.UpdatePageRequest) (bool, error)
	DeletePage(ctx context.Context, id int32) error
}

func NewPageService added in v0.0.2

func NewPageService(queries *dbsqlc.Queries) PageService

type ProjectFetcherService

type ProjectFetcherService interface {
	FetchProjects(context.Context) ([]string, error)
}

type ProjectService

func NewProjectService

func NewProjectService(db *dbsqlc.Queries, logger logging.Logger) ProjectService

type SettingsService

type SettingsService interface{}

type TestCaseImportService added in v0.0.2

type TestCaseImportService interface {
	FromFile(ctx context.Context, projectID int64, file multipart.File, filename string) ([]schema.CreateTestCaseRequest, error)
}

func NewTestCaseImportService added in v0.0.2

func NewTestCaseImportService(projectService ProjectService, logger logging.Logger, cfg config.ImportFileConfiguration) TestCaseImportService

type TestCaseService

type TestCaseService interface {
	// FindAll retrieves all test cases in the database
	FindAll(context.Context) ([]dbsqlc.TestCase, error)

	// FindAllByID retrieves all test cases in the database by Project ID
	FindByID(context.Context, string) (*dbsqlc.TestCase, error)

	// FindAllByProjectID retrieves all test cases in the database by Project ID
	FindAllByProjectID(context.Context, int64) ([]dbsqlc.TestCase, error)

	// FindAllByTestPlanID retrieves all test cases in the database by Test Plan ID
	FindAllByTestPlanID(context.Context, uuid.UUID) ([]dbsqlc.TestCase, error)

	// FindAllCreatedBy retrieves all test cases in the database created by a specific user
	FindAllCreatedBy(context.Context, int64) ([]dbsqlc.TestCase, error)

	// Create creates a new test case
	Create(context.Context, *schema.CreateTestCaseRequest) (*dbsqlc.TestCase, error)

	// BulkCreate creates test cases in bulk. Only valid test cases are created.
	BulkCreate(context.Context, *schema.BulkCreateTestCases) ([]dbsqlc.TestCase, error)

	// Update updates a test case in the system
	Update(context.Context, *schema.UpdateTestCaseRequest) (*dbsqlc.TestCase, error)

	// DeleteByID deletes a single test case by ID
	DeleteByID(context.Context, string) error

	// DeleteByID deletes all test cases linked to the given ProjectID
	DeleteByProjectID(context.Context, string) error

	// DeleteByTestRunID delets all test cases linked to the given TestRun
	DeleteByTestRunID(context.Context, string) error

	// BulkDelete deletes multiple test-cases by ID
	BulkDelete(context.Context, []string) error

	//Search is used to search a test case based on the title or code
	Search(context.Context, string) ([]dbsqlc.TestCase, error)
}

TestCaseService contains functionality to manage services

func NewTestCaseService

func NewTestCaseService(db *sql.DB, conn *dbsqlc.Queries, logger logging.Logger) TestCaseService

type TestPlanService

type TestPlanService interface {
	FindAll(context.Context) ([]dbsqlc.TestPlan, error)
	FindAllByProjectID(context.Context, int64) ([]dbsqlc.TestPlan, error)
	FindAllByTestPlanID(context.Context, int32) ([]dbsqlc.TestRun, error)
	GetOneTestPlan(context.Context, int64) (*dbsqlc.TestPlan, error)
	Create(context.Context, *schema.CreateTestPlan) (*dbsqlc.TestPlan, error)
	AddTestCaseToPlan(context.Context, *schema.AssignTestsToPlanRequest) (*dbsqlc.TestPlan, error)
	DeleteByID(context.Context, int64) error
	Update(context.Context, schema.UpdateTestPlan) (bool, error)
}

func NewTestPlanService

func NewTestPlanService(conn *dbsqlc.Queries, logger logging.Logger) TestPlanService

type TestRunService

type TestRunService interface {
	FindAll(context.Context) ([]dbsqlc.TestRun, error)
	DeleteByID(context.Context, string) error
	FindAllByProjectID(context.Context, int64) ([]dbsqlc.TestRun, error)
	Commit(context.Context, *schema.CommitTestRunResult) (*dbsqlc.TestRun, error)
	CommitBulk(context.Context, *schema.BulkCommitTestResults) (bool, error)
	Create(context.Context, *schema.TestRunRequest) (bool, error)
	GetOneTestRun(context.Context, string) (*dbsqlc.TestRun, error)
	// CreateFromFailedTest records tests without necessarily first creating TestCases.
	//
	// A common use case for Quality Assurance process is reporting things, right now,
	// having to wait for a scheduled Test Plan/Session. This function covers the scenario
	// where Testers need to just record "Issues" (TODO: reconsider the terminology)
	// This allows Testers to record failed tests which get backlinked to default test plan or
	// a specific test plan if specified
	CreateFromFoundIssues(context.Context, *schema.NewFoundIssuesRequest)
}

func NewTestRunService

func NewTestRunService(conn *dbsqlc.Queries, logger logging.Logger) TestRunService

type TesterService

type TesterService interface {
	Assign(ctx context.Context, projectID, userID int64, role string) error
	AssignBulk(ctx context.Context, projectID int64, request *schema.BulkAssignTesters) error
	FindAll(context.Context) ([]schema.Tester, error)
	FindByProjectID(context.Context, int64) ([]schema.Tester, error)
	Invite(context.Context, any) (any, error)
	FindByID(context.Context, int32) (*schema.Tester, error)
}

func NewTesterService

func NewTesterService(db *dbsqlc.Queries, logger logging.Logger) TesterService

type UserService

type UserService interface {
	// FindAll finds all users in the system
	FindAll(context.Context) (*schema.CompactUserListResponse, error)
	// Create creates a new user in the system with the given information
	// provided that the user's email is not already in use and that the information is valid
	Create(context.Context, *schema.NewUserRequest) (*dbsqlc.User, error)
	// GetOne retrives one user from system
	GetOne(ctx context.Context, id int32) (dbsqlc.User, error)
	// SearchUser searches the user in the system based on typed keywords
	Search(ctx context.Context, keyword string) ([]dbsqlc.User, error)
	//Update updates the user
	Update(context.Context, schema.UpdateUserRequest) (bool, error)
	//Delete used to delete user from the system
	Delete(ctx context.Context, id int32) error
	// Invite used to invite a user
	// SignIn allows user to access the system with given credentials
	// Invite used to invite user by email
	Invite(context.Context, string, string) error
}

func NewUserService

func NewUserService(conn *dbsqlc.Queries, logger logging.Logger, smtpCfg config.SMTPConfiguration) UserService

Jump to

Keyboard shortcuts

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