feat(go): port knowledge compilation template/group + wiki artifact/nav/skill REST APIs from Python (#17656)

This commit is contained in:
Zhichang Yu
2026-07-31 22:57:43 +08:00
committed by GitHub
parent d67d14e4c6
commit b811dce1b0
18 changed files with 3428 additions and 54 deletions

View File

@@ -41,6 +41,7 @@ type mockFileCommitSvc struct {
getCommitTreeFn func(ctx context.Context, commitID string) (map[string]interface{}, error)
getCommitFileContentFn func(ctx context.Context, folderID, commitID, fileID string) ([]byte, error)
getFileVersionHistoryFn func(ctx context.Context, fileID string) ([]entity.VersionEntry, error)
listPageCommitsFn func(ctx context.Context, datasetID, pageType, slug string, page, pageSize int) ([]*entity.FileCommit, int64, error)
}
func (m *mockFileCommitSvc) CreateCommit(ctx context.Context, folderID, authorID, message string, changes []entity.FileChange) (*entity.FileCommit, error) {
@@ -128,6 +129,13 @@ func (m *mockFileCommitSvc) GetFileVersionHistory(ctx context.Context, fileID st
}, nil
}
func (m *mockFileCommitSvc) ListPageCommits(ctx context.Context, datasetID, pageType, slug string, page, pageSize int) ([]*entity.FileCommit, int64, error) {
if m.listPageCommitsFn != nil {
return m.listPageCommitsFn(ctx, datasetID, pageType, slug, page, pageSize)
}
return []*entity.FileCommit{}, 0, nil
}
func setupFileCommitTest(userID string) (*gin.Engine, *mockFileCommitSvc) {
mock := &mockFileCommitSvc{}
h := &FileCommitHandler{commitService: mock}