mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-02-08 17:53:33 +08:00
feat: Add CodeSnippet entity and related functionality
- Introduced CodeSnippet schema with fields for snippet details and relationships to WorkspaceFile. - Enhanced WorkspaceFileUpdate and WorkspaceFileUpdateOne to manage snippets, including adding, removing, and clearing snippet relationships. - Updated Swagger documentation to include new API endpoints for CLI command execution and workspace file management. - Implemented domain structures for handling code files and AST parsing results. - Refactored Workspace and WorkspaceFile use cases to support new functionalities. - Adjusted CLI command execution to handle code file information in JSON format. - Improved error handling and logging throughout the workspace and file management processes.
This commit is contained in:
@@ -92,17 +92,20 @@ func (h *WorkspaceFileHandler) GetByID(c *web.Context, req struct {
|
||||
return c.Success(file)
|
||||
}
|
||||
|
||||
// GetAndSave
|
||||
// @Tags WorkspaceFile
|
||||
// @Summary 获取并保存工作区文件
|
||||
// @param ctx
|
||||
// @param req
|
||||
// @return error
|
||||
// GetAndSave
|
||||
//
|
||||
// @Tags WorkspaceFile
|
||||
// @Summary 获取并保存工作区文件
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param req body domain.GetAndSaveReq true "请求参数"
|
||||
// @Success 200 {object} web.Resp{}
|
||||
// @Router /api/v1/workspace/files/get-and-save [post]
|
||||
func (h *WorkspaceFileHandler) GetAndSave(ctx *web.Context, req *domain.GetAndSaveReq) error {
|
||||
err := h.usecase.GetAndSave(ctx.Request().Context(), req)
|
||||
err := h.usecase.GetAndSave(ctx.Request().Context(), req)
|
||||
if err != nil {
|
||||
h.logger.Error("failed to get and save workspace files", "error", err, "count", len(req.CodeFiles.Files))
|
||||
return err
|
||||
return err
|
||||
}
|
||||
return ctx.Success(nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user