모듈 충돌 해결 및 코드 정리
This commit is contained in:
51
core/api.go
51
core/api.go
@ -13,8 +13,8 @@ import (
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"repositories.action2quare.com/ayo/go-ayo/common"
|
||||
"repositories.action2quare.com/ayo/go-ayo/logger"
|
||||
common "repositories.action2quare.com/ayo/gocommon"
|
||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
@ -114,6 +114,32 @@ func (caller apiCaller) isValidUser(service any, category string) (valid bool, a
|
||||
return svcdesc.isValidAPIUser(category, email), false
|
||||
}
|
||||
|
||||
func (caller apiCaller) uploadAPI(w http.ResponseWriter, r *http.Request) error {
|
||||
// file, header, err := r.FormFile("file")
|
||||
// if err != nil {
|
||||
// logger.Error(err)
|
||||
// w.WriteHeader(http.StatusBadRequest)
|
||||
// return
|
||||
// }
|
||||
// defer file.Close()
|
||||
|
||||
// contents, err := io.ReadAll(file)
|
||||
// if err != nil {
|
||||
// logger.Error(err)
|
||||
// w.WriteHeader(http.StatusInternalServerError)
|
||||
// return
|
||||
// }
|
||||
|
||||
// ext := path.Ext(header.Filename)
|
||||
// if ext == ".zip" {
|
||||
|
||||
// }
|
||||
|
||||
// // deploys 폴더는 파일시스템 서비스이므로 다운로드 가능
|
||||
// filename := path.Join("deploys", name, version, name+ext)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (caller apiCaller) whitelistAPI(w http.ResponseWriter, r *http.Request) error {
|
||||
mg := caller.mg
|
||||
queryvals := r.URL.Query()
|
||||
@ -189,6 +215,25 @@ func (caller apiCaller) whitelistAPI(w http.ResponseWriter, r *http.Request) err
|
||||
return nil
|
||||
}
|
||||
|
||||
// func (caller apiCaller) divisionAPI(w http.ResponseWriter, r *http.Request, svcid string, divid string) error {
|
||||
// if r.Method == "PUT" {
|
||||
// // svcid, divid에 statemeta 설정
|
||||
// file, header, err := r.FormFile("file")
|
||||
// if err != nil {
|
||||
// logger.Error(err)
|
||||
// w.WriteHeader(http.StatusBadRequest)
|
||||
// return
|
||||
// }
|
||||
// defer file.Close()
|
||||
|
||||
// if header.
|
||||
// stateFile, header, err := r.FormFile("file")
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
func (caller apiCaller) serviceAPI(w http.ResponseWriter, r *http.Request) error {
|
||||
mg := caller.mg
|
||||
queryvals := r.URL.Query()
|
||||
@ -464,6 +509,8 @@ func (mg *Maingate) api(w http.ResponseWriter, r *http.Request) {
|
||||
err = caller.configAPI(w, r)
|
||||
} else if strings.HasSuffix(r.URL.Path, "/account") {
|
||||
err = caller.accountAPI(w, r)
|
||||
} else if strings.HasSuffix(r.URL.Path, "/upload") {
|
||||
err = caller.uploadAPI(w, r)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user