chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package retriever
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"academy/internal/types/interfaces"
|
||||
)
|
||||
|
||||
// vectorStoreRepoOwnership adapts a VectorStoreRepository to the
|
||||
// TenantStoreOwnership interface consumed by the factory functions.
|
||||
//
|
||||
// The repository's GetByID already scopes to the given tenantID
|
||||
// (WHERE id = ? AND tenant_id = ?), so "exists under this tenant"
|
||||
// is equivalent to "owned by this tenant" — no additional tenant
|
||||
// comparison is needed on top of the returned row.
|
||||
type vectorStoreRepoOwnership struct {
|
||||
repo interfaces.VectorStoreRepository
|
||||
}
|
||||
|
||||
// NewVectorStoreRepoOwnership returns the production
|
||||
// TenantStoreOwnership implementation backed by VectorStoreRepository.
|
||||
func NewVectorStoreRepoOwnership(repo interfaces.VectorStoreRepository) TenantStoreOwnership {
|
||||
return &vectorStoreRepoOwnership{repo: repo}
|
||||
}
|
||||
|
||||
// StoreOwnedBy returns true iff a vector store with the given ID exists
|
||||
// under the given tenant. Errors are reserved for infrastructure failures;
|
||||
// a non-existent (but well-formed) store ID returns (false, nil).
|
||||
func (o *vectorStoreRepoOwnership) StoreOwnedBy(ctx context.Context, storeID string, tenantID uint64) (bool, error) {
|
||||
store, err := o.repo.GetByID(ctx, tenantID, storeID)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return store != nil, nil
|
||||
}
|
||||
Reference in new issue
Block a user