This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/server/store/project_interface.go
2026-03-17 16:28:47 +00:00

71 lines
2.4 KiB
Go

package store
import (
"context"
"time"
"git.gobha.me/xcaliber/chat-switchboard/models"
)
// =========================================
// PROJECT STORE (v0.19.0)
// =========================================
type ProjectStore interface {
// CRUD
Create(ctx context.Context, p *models.Project) error
GetByID(ctx context.Context, id string) (*models.Project, error)
Update(ctx context.Context, id string, patch models.ProjectPatch) error
Delete(ctx context.Context, id string) error
// Listing
ListForUser(ctx context.Context, userID string, teamIDs []string, includeArchived bool) ([]models.Project, error)
// Channel association (atomic move: removes old project if any)
AddChannel(ctx context.Context, projectID, channelID string, position int) error
RemoveChannel(ctx context.Context, projectID, channelID string) error
ListChannels(ctx context.Context, projectID string) ([]models.ProjectChannel, error)
ReorderChannels(ctx context.Context, projectID string, channelIDs []string) error
// KB association
AddKB(ctx context.Context, projectID, kbID string, autoSearch bool) error
RemoveKB(ctx context.Context, projectID, kbID string) error
ListKBs(ctx context.Context, projectID string) ([]models.ProjectKB, error)
// Note association
AddNote(ctx context.Context, projectID, noteID string) error
RemoveNote(ctx context.Context, projectID, noteID string) error
ListNotes(ctx context.Context, projectID string) ([]models.ProjectNote, error)
// Access check
UserCanAccess(ctx context.Context, userID, projectID string, teamIDs []string) (bool, error)
// Get project ID for a channel (used during note auto-association)
GetProjectIDForChannel(ctx context.Context, channelID string) (string, error)
// Get KB IDs bound to a project (used for virtual injection at completion)
GetKBIDs(ctx context.Context, projectID string) ([]string, error)
// ── CS5c additions (v0.29.0) ──
// AdminList returns all projects with counts and owner names (admin only).
AdminList(ctx context.Context, includeArchived bool) ([]AdminProject, error)
}
// AdminProject is returned by ProjectStore.AdminList.
type AdminProject struct {
ID string
Name string
Description string
Scope string
OwnerID string
TeamID *string
IsArchived bool
CreatedAt time.Time
UpdatedAt time.Time
ChannelCount int
KBCount int
NoteCount int
OwnerName string
}