workspace

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MountWorkspaceHandlers

func MountWorkspaceHandlers(s *apikit.Server, db *apikit.DB) error

MountWorkspaceHandlers initialises the workspace schema, registers workspace permission scopes with apikit (via MountHandlers), and mounts workspace API handlers on the server's API group.

This is the single entry point for wiring up workspace support in af-hub. It calls s.MountHandlers to register both apikit's built-in handlers and workspace-specific permission scopes, then registers workspace routes.

Must be called after NewServer and before Start.

func RegisterRoutes

func RegisterRoutes(api *echo.Group, db *sql.DB) error

RegisterRoutes mounts workspace API handlers on the given echo group. This is also used by tests which set up their own echo instance and auth middleware instead of using the full apikit server stack.

func WorkspacePermissions

func WorkspacePermissions() []apikit.Permission

WorkspacePermissions returns the Permission values that hub registers with apikit's MountHandlers for workspace operations.

Types

type AuthInfo

type AuthInfo struct {
	CredType    CredentialType `json:"cred_type"`
	UserID      string         `json:"user_id"`
	Permissions []string       `json:"permissions"`
}

AuthInfo holds the authenticated identity and permissions for a request.

func (*AuthInfo) String

func (a *AuthInfo) String() string

String returns a human-readable representation of the AuthInfo (for debugging).

type CredentialType

type CredentialType string

CredentialType identifies the type of credential used to authenticate a request.

const (
	// CredentialAdmin represents an admin token.
	CredentialAdmin CredentialType = "admin"
	// CredentialAPIKey represents a user API key.
	CredentialAPIKey CredentialType = "apikey"
	// CredentialPAT represents a personal access token.
	CredentialPAT CredentialType = "pat"
)

type OrgMembershipCheckFunc

type OrgMembershipCheckFunc func(db *sql.DB, userID, orgID string) (int, string)

OrgMembershipCheckFunc is the signature for org membership checks. Returns (0, "") on success, or (httpCode, message) on failure.

type Workspace

type Workspace struct {
	Slug        string
	GitURL      string
	Branch      *string // nullable
	OwnerID     string
	OrgID       *string // nullable
	Status      string
	DisplayName string
	Description string
	CreatedAt   string
	UpdatedAt   string
}

Workspace represents a workspace record in the workspaces table.

Jump to

Keyboard shortcuts

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