chore: add more openai
This commit is contained in:
@@ -18,6 +18,15 @@ func NewEnvController(envService *services.EnvService) *EnvController {
|
||||
}
|
||||
|
||||
// CreateEnvVar 创建环境变量
|
||||
// @Summary 创建环境变量
|
||||
// @Description 创建一个新的环境变量
|
||||
// @Tags 环境变量
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param body body object true "环境变量信息"
|
||||
// @Success 200 {object} utils.Response{data=vo.EnvVO}
|
||||
// @Router /env [post]
|
||||
func (ec *EnvController) CreateEnvVar(c *gin.Context) {
|
||||
userID := c.GetString("userID")
|
||||
|
||||
@@ -105,6 +114,17 @@ func (ec *EnvController) GetEnvVar(c *gin.Context) {
|
||||
}
|
||||
|
||||
// UpdateEnvVar 更新环境变量
|
||||
// @Summary 更新环境变量
|
||||
// @Description 根据 ID 更新环境变量信息
|
||||
// @Tags 环境变量
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "环境变量ID"
|
||||
// @Param body body object true "环境变量更新信息"
|
||||
// @Success 200 {object} utils.Response{data=vo.EnvVO}
|
||||
// @Failure 404 {object} utils.Response
|
||||
// @Router /env/{id} [put]
|
||||
func (ec *EnvController) UpdateEnvVar(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
@@ -145,6 +165,18 @@ func (ec *EnvController) UpdateEnvVar(c *gin.Context) {
|
||||
}
|
||||
|
||||
// DeleteEnvVar 删除环境变量
|
||||
// @Summary 删除环境变量
|
||||
// @Description 根据 ID 删除环境变量
|
||||
// @Tags 环境变量
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "环境变量ID"
|
||||
// @Param force query boolean false "强制删除(忽略任务关联)"
|
||||
// @Success 200 {object} utils.Response
|
||||
// @Failure 404 {object} utils.Response
|
||||
// @Failure 409 {object} utils.Response{data=[]vo.TaskVO}
|
||||
// @Router /env/{id} [delete]
|
||||
func (ec *EnvController) DeleteEnvVar(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
|
||||
@@ -17,6 +17,16 @@ func NewScriptController(scriptService *services.ScriptService) *ScriptControlle
|
||||
return &ScriptController{scriptService: scriptService}
|
||||
}
|
||||
|
||||
// CreateScript 创建脚本
|
||||
// @Summary 创建脚本
|
||||
// @Description 创建一个新的脚本
|
||||
// @Tags 脚本管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param body body object true "脚本信息"
|
||||
// @Success 200 {object} utils.Response{data=vo.ScriptVO}
|
||||
// @Router /scripts [post]
|
||||
func (sc *ScriptController) CreateScript(c *gin.Context) {
|
||||
userID := c.GetString("userID")
|
||||
|
||||
@@ -34,6 +44,15 @@ func (sc *ScriptController) CreateScript(c *gin.Context) {
|
||||
utils.Success(c, vo.ToScriptVO(script))
|
||||
}
|
||||
|
||||
// GetScripts 获取脚本列表
|
||||
// @Summary 获取脚本列表
|
||||
// @Description 获取当前用户的所有脚本(内容字段为空)
|
||||
// @Tags 脚本管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Success 200 {object} utils.Response{data=[]vo.ScriptVO}
|
||||
// @Router /scripts [get]
|
||||
func (sc *ScriptController) GetScripts(c *gin.Context) {
|
||||
userID := c.GetString("userID")
|
||||
scripts := sc.scriptService.GetScriptsByUserID(userID)
|
||||
@@ -44,6 +63,17 @@ func (sc *ScriptController) GetScripts(c *gin.Context) {
|
||||
utils.Success(c, vos)
|
||||
}
|
||||
|
||||
// GetScript 获取脚本详情
|
||||
// @Summary 获取脚本详情
|
||||
// @Description 根据 ID 获取脚本详情
|
||||
// @Tags 脚本管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "脚本ID"
|
||||
// @Success 200 {object} utils.Response{data=vo.ScriptVO}
|
||||
// @Failure 404 {object} utils.Response
|
||||
// @Router /scripts/{id} [get]
|
||||
func (sc *ScriptController) GetScript(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
@@ -60,6 +90,18 @@ func (sc *ScriptController) GetScript(c *gin.Context) {
|
||||
utils.Success(c, vo.ToScriptVO(script))
|
||||
}
|
||||
|
||||
// UpdateScript 更新脚本
|
||||
// @Summary 更新脚本
|
||||
// @Description 根据 ID 更新脚本信息
|
||||
// @Tags 脚本管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "脚本ID"
|
||||
// @Param body body object true "脚本更新信息"
|
||||
// @Success 200 {object} utils.Response{data=vo.ScriptVO}
|
||||
// @Failure 404 {object} utils.Response
|
||||
// @Router /scripts/{id} [put]
|
||||
func (sc *ScriptController) UpdateScript(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
@@ -86,6 +128,17 @@ func (sc *ScriptController) UpdateScript(c *gin.Context) {
|
||||
utils.Success(c, vo.ToScriptVO(script))
|
||||
}
|
||||
|
||||
// DeleteScript 删除脚本
|
||||
// @Summary 删除脚本
|
||||
// @Description 根据 ID 删除脚本
|
||||
// @Tags 脚本管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "脚本ID"
|
||||
// @Success 200 {object} utils.Response
|
||||
// @Failure 404 {object} utils.Response
|
||||
// @Router /scripts/{id} [delete]
|
||||
func (sc *ScriptController) DeleteScript(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
|
||||
Reference in New Issue
Block a user