refactor: updated cmd and pkg implementations
This commit is contained in:
parent
d88ab2c01f
commit
fbed466c3d
10 changed files with 287 additions and 196 deletions
|
|
@ -181,18 +181,9 @@ func (s *Service) Download() http.HandlerFunc {
|
|||
|
||||
func (s *Service) Upload() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) UploadPlugin() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) UploadProfile() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
_ = s.PathForData() + strings.TrimPrefix(r.URL.Path, "/upload")
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -239,6 +230,23 @@ func (s *Service) List() http.HandlerFunc {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *Service) Delete() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
path = s.PathForData() + strings.TrimPrefix(r.URL.Path, "/delete")
|
||||
err error
|
||||
)
|
||||
|
||||
err = os.RemoveAll(path)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) GetStatus(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
err := json.NewEncoder(w).Encode(map[string]any{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue