splitted one operator module to file, account, image operators; splitted operator functions; etc

This commit is contained in:
2026-03-05 11:32:32 +02:00
parent 9ecd25ed0b
commit 80d6a244cf
54 changed files with 1049 additions and 826 deletions
+15 -15
View File
@@ -13,7 +13,7 @@ import (
"io"
"net/http"
"mstore/app/operator"
"mstore/app/fileoper"
"mstore/app/router"
"mstore/pkg/terms"
)
@@ -23,7 +23,7 @@ const zeroContentLength = "0"
func (hand *Handler) FileInfo(rctx *router.Context) {
filepath, _ := rctx.GetSubpath("filepath")
params := &operator.FileInfoParams{
params := &fileoper.FileInfoParams{
Filepath: filepath,
}
// Rigth checking
@@ -39,7 +39,7 @@ func (hand *Handler) FileInfo(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
code, res, err := hand.oper.FileInfo(ctx, operatorID, params)
code, res, err := hand.fiop.FileInfo(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("FileInfo error: %v", err)
rctx.SetStatus(code)
@@ -65,7 +65,7 @@ func (hand *Handler) PutFile(rctx *router.Context) {
contentType := rctx.GetHeader("Content-Type")
filepath, _ := rctx.GetSubpath("filepath")
params := &operator.PutFileParams{
params := &fileoper.PutFileParams{
Filepath: filepath,
ContentType: contentType,
ContentSize: contentSize,
@@ -84,7 +84,7 @@ func (hand *Handler) PutFile(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
code, _, err := hand.oper.PutFile(ctx, operatorID, params)
code, _, err := hand.fiop.PutFile(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("PutFile error: %v", err)
rctx.SetStatus(code)
@@ -96,7 +96,7 @@ func (hand *Handler) PutFile(rctx *router.Context) {
func (hand *Handler) GetFile(rctx *router.Context) {
filepath, _ := rctx.GetSubpath("filepath")
params := &operator.GetFileParams{
params := &fileoper.GetFileParams{
Filepath: filepath,
}
// Rigth checking
@@ -112,7 +112,7 @@ func (hand *Handler) GetFile(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
code, res, err := hand.oper.GetFile(ctx, operatorID, params)
code, res, err := hand.fiop.GetFile(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("PutFile error: %v", err)
rctx.SetStatus(code)
@@ -144,7 +144,7 @@ func (hand *Handler) GetFile(rctx *router.Context) {
func (hand *Handler) DeleteFile(rctx *router.Context) {
filepath, _ := rctx.GetSubpath("filepath")
params := &operator.DeleteFileParams{
params := &fileoper.DeleteFileParams{
Filepath: filepath,
}
// Rigth checking
@@ -160,7 +160,7 @@ func (hand *Handler) DeleteFile(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
code, _, err := hand.oper.DeleteFile(ctx, operatorID, params)
code, _, err := hand.fiop.DeleteFile(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("DeleteFIle error: %v", err)
}
@@ -174,7 +174,7 @@ func (hand *Handler) ListFiles(rctx *router.Context) {
if filepath == "" {
filepath = "/"
}
params := &operator.ListFilesParams{
params := &fileoper.ListFilesParams{
Filepath: filepath,
}
err := rctx.BindQuery(params)
@@ -197,7 +197,7 @@ func (hand *Handler) ListFiles(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
code, res, err := hand.oper.ListFiles(ctx, operatorID, params)
code, res, err := hand.fiop.ListFiles(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("ListFiles error: %v", err)
rctx.SetStatus(code)
@@ -212,7 +212,7 @@ func (hand *Handler) ListCollections(rctx *router.Context) {
if cpath == "" {
cpath = "/"
}
params := &operator.ListCollectionsParams{
params := &fileoper.ListCollectionsParams{
Path: cpath,
}
err := rctx.BindQuery(params)
@@ -234,7 +234,7 @@ func (hand *Handler) ListCollections(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
code, res, err := hand.oper.ListCollections(ctx, operatorID, params)
code, res, err := hand.fiop.ListCollections(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("ListCollections error: %v", err)
rctx.SetStatus(code)
@@ -249,7 +249,7 @@ func (hand *Handler) DeleteCollection(rctx *router.Context) {
if cpath == "" {
cpath = "/"
}
params := &operator.DeleteColletionParams{
params := &fileoper.DeleteColletionParams{
Path: cpath,
}
err := rctx.BindQuery(params)
@@ -272,7 +272,7 @@ func (hand *Handler) DeleteCollection(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
code, res, err := hand.oper.DeleteColletion(ctx, operatorID, params)
code, res, err := hand.fiop.DeleteColletion(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("DeleteColletion error: %v", err)
rctx.SetStatus(code)