Compare commits
No commits in common. "1dd4fa22cdfc749c5474f94108bca0aec34aea81" and "bb26cfca5b4017bbbbf5aeee9bd3577c724f83ca" have entirely different histories.
1dd4fa22cd
...
bb26cfca5b
|
@ -3,7 +3,6 @@ package controller
|
||||||
import (
|
import (
|
||||||
"git.lumeweb.com/LumeWeb/portal/controller/request"
|
"git.lumeweb.com/LumeWeb/portal/controller/request"
|
||||||
"git.lumeweb.com/LumeWeb/portal/controller/response"
|
"git.lumeweb.com/LumeWeb/portal/controller/response"
|
||||||
"git.lumeweb.com/LumeWeb/portal/middleware"
|
|
||||||
"git.lumeweb.com/LumeWeb/portal/service/auth"
|
"git.lumeweb.com/LumeWeb/portal/service/auth"
|
||||||
"github.com/kataras/iris/v12"
|
"github.com/kataras/iris/v12"
|
||||||
)
|
)
|
||||||
|
@ -100,13 +99,3 @@ func (a *AuthController) PostLogout() {
|
||||||
// Return a success response to the client.
|
// Return a success response to the client.
|
||||||
a.Ctx.StatusCode(iris.StatusNoContent)
|
a.Ctx.StatusCode(iris.StatusNoContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AuthController) GetStatus() {
|
|
||||||
middleware.VerifyJwt(a.Ctx)
|
|
||||||
|
|
||||||
if a.Ctx.IsStopped() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
a.respondJSON(&response.AuthStatusResponse{Status: true})
|
|
||||||
}
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ func (f *FilesController) GetStatusBy(cidString string) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
f.respondJSON(&response.FileStatusResponse{Status: statusCode})
|
f.respondJSON(&response.StatusResponse{Status: statusCode})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
package response
|
|
||||||
|
|
||||||
type AuthStatusResponse struct {
|
|
||||||
Status bool `json:"status"`
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
package response
|
package response
|
||||||
|
|
||||||
type FileStatusResponse struct {
|
type StatusResponse struct {
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
}
|
}
|
|
@ -80,14 +80,17 @@ func Upload(r io.ReadSeeker, size int64, hash []byte) (model.Upload, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
result := db.Get().Where(&model.Upload{Hash: hashHex}).First(&upload)
|
result := db.Get().Where(&model.Upload{Hash: hashHex}).First(&upload)
|
||||||
if !errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
if (result.Error != nil && !errors.Is(result.Error, gorm.ErrRecordNotFound)) || result.RowsAffected > 0 {
|
||||||
|
err := result.Row().Scan(&upload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Get().Error(ErrFailedQueryUpload.Error(), zap.Error(err))
|
logger.Get().Error(ErrFailedQueryUpload.Error(), zap.Error(err))
|
||||||
return upload, ErrFailedQueryUpload
|
return upload, ErrFailedQueryUpload
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Get().Info(ErrAlreadyExists.Error())
|
if result.RowsAffected > 0 && upload.ID > 0 {
|
||||||
return upload, nil
|
logger.Get().Info(ErrAlreadyExists.Error())
|
||||||
|
return upload, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
objectExistsResult, err := client.R().Get(getBusObjectUrl(hashHex))
|
objectExistsResult, err := client.R().Get(getBusObjectUrl(hashHex))
|
||||||
|
|
Loading…
Reference in New Issue