fix: upload idl split

This commit is contained in:
lijunwen.gigoo
2025-07-21 17:08:05 +08:00
parent 890153324f
commit 82e55ffdb8
13 changed files with 5620 additions and 6093 deletions

View File

@@ -413,51 +413,3 @@ func GetTypeList(ctx context.Context, c *app.RequestContext) {
c.JSON(consts.StatusOK, resp)
}
// CommonUpload .
// @router /api/playground/upload [POST]
func CommonUpload(ctx context.Context, c *app.RequestContext) {
var err error
var req developer_api.CommonUploadRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
fullUrl := string(c.Request.URI().FullURI())
resp, err := upload.SVC.UploadFileCommon(ctx, &req, fullUrl)
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
c.JSON(consts.StatusOK, resp)
}
// ApplyUploadAction .
// @router /api/playground/apply_upload_action [GET]
func ApplyUploadAction(ctx context.Context, c *app.RequestContext) {
var err error
var req developer_api.ApplyUploadActionRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(developer_api.ApplyUploadActionResponse)
host := c.Request.Host()
if ptr.From(req.Action) == "ApplyImageUpload" {
resp, err = upload.SVC.ApplyImageUpload(ctx, &req, string(host))
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
} else if ptr.From(req.Action) == "CommitImageUpload" {
resp, err = upload.SVC.CommitImageUpload(ctx, &req, string(host))
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
}
c.JSON(consts.StatusOK, resp)
}