Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions agent/app/api/v2/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (
// @Summary List apps
// @Accept json
// @Param request body request.AppSearch true "request"
// @Success 200
// @Success 200 {object} response.AppRes
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/search [post]
func (b *BaseApi) SearchApp(c *gin.Context) {
var req request.AppSearch
Expand All @@ -32,6 +33,7 @@ func (b *BaseApi) SearchApp(c *gin.Context) {
// @Summary Sync remote app list
// @Success 200
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/sync/remote [post]
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"应用商店同步","formatEN":"App store synchronization"}
func (b *BaseApi) SyncApp(c *gin.Context) {
Expand All @@ -56,13 +58,14 @@ func (b *BaseApi) SyncApp(c *gin.Context) {
helper.InternalServer(c, err)
return
}
helper.SuccessWithData(c, nil)
helper.SuccessWithOutData(c)
}

// @Tags App
// @Summary Sync local app list
// @Success 200
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/sync/local [post]
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"应用商店同步","formatEN":"App store synchronization"}
func (b *BaseApi) SyncLocalApp(c *gin.Context) {
Expand All @@ -80,6 +83,7 @@ func (b *BaseApi) SyncLocalApp(c *gin.Context) {
// @Param key path string true "app key"
// @Success 200 {object} response.AppDTO
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/:key [get]
func (b *BaseApi) GetApp(c *gin.Context) {
appKey, err := helper.GetStrParamByKey(c, "key")
Expand All @@ -103,6 +107,7 @@ func (b *BaseApi) GetApp(c *gin.Context) {
// @Param version path string true "app 类型"
// @Success 200 {object} response.AppDetailDTO
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/detail/:appId/:version/:type [get]
func (b *BaseApi) GetAppDetail(c *gin.Context) {
appID, err := helper.GetIntParamByKey(c, "appId")
Expand All @@ -126,6 +131,7 @@ func (b *BaseApi) GetAppDetail(c *gin.Context) {
// @Param appId path integer true "id"
// @Success 200 {object} response.AppDetailDTO
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/details/:id [get]
func (b *BaseApi) GetAppDetailByID(c *gin.Context) {
appDetailID, err := helper.GetIntParamByKey(c, "id")
Expand All @@ -144,8 +150,9 @@ func (b *BaseApi) GetAppDetailByID(c *gin.Context) {
// @Tags App
// @Summary Get Ignore App
// @Accept json
// @Success 200 {object} response.IgnoredApp
// @Success 200 {array} response.IgnoredApp
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/ignored [get]
func (b *BaseApi) GetIgnoredApp(c *gin.Context) {
res, err := appService.GetIgnoredApp()
Expand All @@ -162,6 +169,7 @@ func (b *BaseApi) GetIgnoredApp(c *gin.Context) {
// @Param request body request.AppInstallCreate true "request"
// @Success 200 {object} model.AppInstall
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/install [post]
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"安装应用 [name]","formatEN":"Install app [name]"}
func (b *BaseApi) InstallApp(c *gin.Context) {
Expand All @@ -188,8 +196,9 @@ func (b *BaseApi) GetAppTags(c *gin.Context) {

// @Tags App
// @Summary Get app list update
// @Success 200
// @Success 200 {object} response.AppUpdateRes
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/checkupdate [get]
func (b *BaseApi) GetAppListUpdate(c *gin.Context) {
res, err := appService.GetAppUpdate()
Expand All @@ -206,6 +215,7 @@ func (b *BaseApi) GetAppListUpdate(c *gin.Context) {
// @Param request body request.AppstoreUpdate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/store/update [post]
func (b *BaseApi) UpdateAppstoreConfig(c *gin.Context) {
var req request.AppstoreUpdate
Expand All @@ -224,6 +234,7 @@ func (b *BaseApi) UpdateAppstoreConfig(c *gin.Context) {
// @Summary Get appstore config
// @Success 200 {object} response.AppstoreConfig
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/store/config [get]
func (b *BaseApi) GetAppstoreConfig(c *gin.Context) {
res, err := appService.GetAppstoreConfig()
Expand Down
32 changes: 24 additions & 8 deletions agent/app/api/v2/app_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (
// @Summary Page app installed
// @Accept json
// @Param request body request.AppInstalledSearch true "request"
// @Success 200
// @Success 200 {object} dto.PageResult
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/search [post]
func (b *BaseApi) SearchAppInstalled(c *gin.Context) {
var req request.AppInstalledSearch
Expand Down Expand Up @@ -43,8 +44,9 @@ func (b *BaseApi) SearchAppInstalled(c *gin.Context) {
// @Tags App
// @Summary List app installed
// @Accept json
// @Success 200 array dto.AppInstallInfo
// @Success 200 {array} dto.AppInstallInfo
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/list [get]
func (b *BaseApi) ListAppInstalled(c *gin.Context) {
list, err := appInstallService.GetInstallList()
Expand All @@ -61,6 +63,7 @@ func (b *BaseApi) ListAppInstalled(c *gin.Context) {
// @Param request body request.AppInstalledInfo true "request"
// @Success 200 {object} response.AppInstalledCheck
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/check [post]
func (b *BaseApi) CheckAppInstalled(c *gin.Context) {
var req request.AppInstalledInfo
Expand All @@ -81,6 +84,7 @@ func (b *BaseApi) CheckAppInstalled(c *gin.Context) {
// @Param request body dto.OperationWithNameAndType true "request"
// @Success 200 {integer} port
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/loadport [post]
func (b *BaseApi) LoadPort(c *gin.Context) {
var req dto.OperationWithNameAndType
Expand All @@ -99,8 +103,9 @@ func (b *BaseApi) LoadPort(c *gin.Context) {
// @Summary Search app password by key
// @Accept json
// @Param request body dto.OperationWithNameAndType true "request"
// @Success 200 {string} response.DatabaseConn
// @Success 200 {object} response.DatabaseConn
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/conninfo/:key [get]
func (b *BaseApi) LoadConnInfo(c *gin.Context) {
var req dto.OperationWithNameAndType
Expand All @@ -121,6 +126,7 @@ func (b *BaseApi) LoadConnInfo(c *gin.Context) {
// @Param appInstallId path integer true "App install id"
// @Success 200 {array} dto.AppResource
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/delete/check/:appInstallId [get]
func (b *BaseApi) DeleteCheck(c *gin.Context) {
appInstallId, err := helper.GetIntParamByKey(c, "appInstallId")
Expand All @@ -141,14 +147,15 @@ func (b *BaseApi) DeleteCheck(c *gin.Context) {
// @Summary Sync app installed
// @Success 200
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/sync [post]
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"同步已安装应用列表","formatEN":"Sync the list of installed apps"}
func (b *BaseApi) SyncInstalled(c *gin.Context) {
if err := appInstallService.SyncAll(false); err != nil {
helper.InternalServer(c, err)
return
}
helper.SuccessWithData(c, "")
helper.SuccessWithOutData(c)
}

// @Tags App
Expand All @@ -157,6 +164,7 @@ func (b *BaseApi) SyncInstalled(c *gin.Context) {
// @Param request body request.AppInstalledOperate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/op [post]
// @x-panel-log {"bodyKeys":["installId","operate"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"installId","isList":false,"db":"app_installs","output_column":"app_id","output_value":"appId"},{"input_column":"id","input_value":"installId","isList":false,"db":"app_installs","output_column":"name","output_value":"appName"},{"input_column":"id","input_value":"appId","isList":false,"db":"apps","output_column":"key","output_value":"appKey"}],"formatZH":"[operate] 应用 [appKey][appName]","formatEN":"[operate] App [appKey][appName]"}
func (b *BaseApi) OperateInstalled(c *gin.Context) {
Expand All @@ -168,7 +176,7 @@ func (b *BaseApi) OperateInstalled(c *gin.Context) {
helper.InternalServer(c, err)
return
}
helper.SuccessWithData(c, nil)
helper.SuccessWithOutData(c)
}

// @Tags App
Expand All @@ -177,6 +185,7 @@ func (b *BaseApi) OperateInstalled(c *gin.Context) {
// @Param key path string true "request"
// @Success 200 {array} response.AppService
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/services/:key [get]
func (b *BaseApi) GetServices(c *gin.Context) {
key := c.Param("key")
Expand All @@ -194,6 +203,7 @@ func (b *BaseApi) GetServices(c *gin.Context) {
// @Param appInstallId path integer true "request"
// @Success 200 {array} dto.AppVersion
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/update/versions [post]
func (b *BaseApi) GetUpdateVersions(c *gin.Context) {
var req request.AppUpdateVersion
Expand All @@ -214,6 +224,7 @@ func (b *BaseApi) GetUpdateVersions(c *gin.Context) {
// @Param request body request.PortUpdate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/port/change [post]
// @x-panel-log {"bodyKeys":["key","name","port"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"应用端口修改 [key]-[name] => [port]","formatEN":"Application port update [key]-[name] => [port]"}
func (b *BaseApi) ChangeAppPort(c *gin.Context) {
Expand All @@ -225,7 +236,7 @@ func (b *BaseApi) ChangeAppPort(c *gin.Context) {
helper.InternalServer(c, err)
return
}
helper.SuccessWithData(c, nil)
helper.SuccessWithOutData(c)
}

// @Tags App
Expand All @@ -234,6 +245,7 @@ func (b *BaseApi) ChangeAppPort(c *gin.Context) {
// @Param request body dto.OperationWithNameAndType true "request"
// @Success 200 {string} content
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/conf [post]
func (b *BaseApi) GetDefaultConfig(c *gin.Context) {
var req dto.OperationWithNameAndType
Expand All @@ -253,8 +265,9 @@ func (b *BaseApi) GetDefaultConfig(c *gin.Context) {
// @Summary Search params by appInstallId
// @Accept json
// @Param appInstallId path string true "request"
// @Success 200 {object} response.AppParam
// @Success 200 {object} response.AppConfig
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/params/:appInstallId [get]
func (b *BaseApi) GetParams(c *gin.Context) {
appInstallId, err := helper.GetIntParamByKey(c, "appInstallId")
Expand All @@ -276,6 +289,7 @@ func (b *BaseApi) GetParams(c *gin.Context) {
// @Param request body request.AppInstalledUpdate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/params/update [post]
// @x-panel-log {"bodyKeys":["installId"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"应用参数修改 [installId]","formatEN":"Application param update [installId]"}
func (b *BaseApi) UpdateInstalled(c *gin.Context) {
Expand All @@ -287,7 +301,7 @@ func (b *BaseApi) UpdateInstalled(c *gin.Context) {
helper.InternalServer(c, err)
return
}
helper.SuccessWithData(c, nil)
helper.SuccessWithOutData(c)
}

// @Tags App
Expand All @@ -296,6 +310,7 @@ func (b *BaseApi) UpdateInstalled(c *gin.Context) {
// @Param request body request.AppInstalledIgnoreUpgrade true "request"
// @Success 200
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/ignore [post]
// @x-panel-log {"bodyKeys":["installId"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"忽略应用 [installId] 版本升级","formatEN":"Application param update [installId]"}
func (b *BaseApi) IgnoreUpgrade(c *gin.Context) {
Expand All @@ -316,6 +331,7 @@ func (b *BaseApi) IgnoreUpgrade(c *gin.Context) {
// @Param request body request.AppConfigUpdate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /apps/installed/config/update [post]
// @x-panel-log {"bodyKeys":["installID","webUI"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"应用配置更新 [installID]","formatEN":"Application config update [installID]"}
func (b *BaseApi) UpdateAppConfig(c *gin.Context) {
Expand Down
Loading
Loading