(ctx echo.Context)
| 16 | ) |
| 17 | |
| 18 | func ListStorages(ctx echo.Context) error { |
| 19 | r, err := service.MyService.Storage().GetStorages() |
| 20 | if err != nil { |
| 21 | return ctx.JSON(common_err.SUCCESS, model.Result{Success: common_err.SERVICE_ERROR, Message: common_err.GetMsg(common_err.SERVICE_ERROR), Data: err.Error()}) |
| 22 | } |
| 23 | |
| 24 | for i := 0; i < len(r.MountPoints); i++ { |
| 25 | dataMap, err := service.MyService.Storage().GetConfigByName(r.MountPoints[i].Fs) |
| 26 | if err != nil { |
| 27 | logger.Error("GetConfigByName", zap.Any("err", err)) |
| 28 | continue |
| 29 | } |
| 30 | if dataMap["type"] == "drive" { |
| 31 | r.MountPoints[i].Icon = google_drive.ICONURL |
| 32 | } |
| 33 | if dataMap["type"] == "dropbox" { |
| 34 | r.MountPoints[i].Icon = dropbox.ICONURL |
| 35 | } |
| 36 | if dataMap["type"] == "onedrive" { |
| 37 | r.MountPoints[i].Icon = onedrive.ICONURL |
| 38 | } |
| 39 | r.MountPoints[i].Name = dataMap["username"] |
| 40 | } |
| 41 | list := []httper.MountPoint{} |
| 42 | |
| 43 | for _, v := range r.MountPoints { |
| 44 | list = append(list, httper.MountPoint(v)) |
| 45 | } |
| 46 | |
| 47 | return ctx.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: list}) |
| 48 | } |
| 49 | |
| 50 | func UmountStorage(ctx echo.Context) error { |
| 51 | json := make(map[string]string) |
nothing calls this directly
no test coverage detected