working commit
This commit is contained in:
+11
-11
@@ -23,7 +23,7 @@ import (
|
||||
|
||||
"mstore/pkg/auxtool"
|
||||
"mstore/pkg/descr"
|
||||
"mstore/pkg/terms"
|
||||
"mstore/pkg/term"
|
||||
"mstore/pkg/uuid"
|
||||
)
|
||||
|
||||
@@ -288,7 +288,7 @@ func (oper *Operator) DeleteFile(ctx context.Context, operatorID uuid.UUID, para
|
||||
// ListFiles
|
||||
type ListFilesParams struct {
|
||||
Filepath string
|
||||
PathAs terms.PathUsage `param:"pathAs"`
|
||||
PathAs term.PathUsage `param:"pathAs"`
|
||||
}
|
||||
type ListFilesResult struct {
|
||||
Files []descr.File `json:"files,omitempty"`
|
||||
@@ -300,14 +300,14 @@ func (oper *Operator) ListFiles(ctx context.Context, operatorID uuid.UUID, param
|
||||
Files: make([]descr.File, 0),
|
||||
}
|
||||
switch params.PathAs {
|
||||
case terms.AsRegexp:
|
||||
case term.AsRegexp:
|
||||
files, err := oper.listFilesWithRegex(ctx, params.Filepath)
|
||||
if err != nil {
|
||||
code := http.StatusInternalServerError
|
||||
return code, res, err
|
||||
}
|
||||
res.Files = files
|
||||
case terms.AsPrefix:
|
||||
case term.AsPrefix:
|
||||
params.Filepath, err = cleanFilepath(params.Filepath)
|
||||
if err != nil {
|
||||
code := http.StatusInternalServerError
|
||||
@@ -400,7 +400,7 @@ func (oper *Operator) listFilesWithRegex(ctx context.Context, regex string) ([]d
|
||||
// ListCollections
|
||||
type ListCollectionsParams struct {
|
||||
Path string
|
||||
PathAS terms.PathUsage `param:"pathAs"`
|
||||
PathAS term.PathUsage `param:"pathAs"`
|
||||
}
|
||||
type ListCollectionsResult struct {
|
||||
Collections []string `json:"collection,omitempty"`
|
||||
@@ -414,13 +414,13 @@ func (oper *Operator) ListCollections(ctx context.Context, operatorID uuid.UUID,
|
||||
|
||||
collectionList := make([]string, 0)
|
||||
switch param.PathAS {
|
||||
case terms.AsRegexp:
|
||||
case term.AsRegexp:
|
||||
collectionList, err = oper.listCollectionsWithRegexp(ctx, param.Path)
|
||||
if err != nil {
|
||||
code := http.StatusInternalServerError
|
||||
return code, res, err
|
||||
}
|
||||
case terms.AsPrefix:
|
||||
case term.AsPrefix:
|
||||
param.Path, err = cleanFilepath(param.Path)
|
||||
if err != nil {
|
||||
code := http.StatusInternalServerError
|
||||
@@ -532,8 +532,8 @@ func (oper *Operator) listAllCollections(ctx context.Context) ([]string, error)
|
||||
// DeleteColletion
|
||||
type DeleteColletionParams struct {
|
||||
Path string
|
||||
PathAs terms.PathUsage `param:"pathAs"`
|
||||
DryRun bool `param:"dryRun"`
|
||||
PathAs term.PathUsage `param:"pathAs"`
|
||||
DryRun bool `param:"dryRun"`
|
||||
}
|
||||
type DeleteColletionResult struct {
|
||||
Files []descr.File `json:"files,omitempty"`
|
||||
@@ -545,7 +545,7 @@ func (oper *Operator) DeleteColletion(ctx context.Context, operatorID uuid.UUID,
|
||||
Files: make([]descr.File, 0),
|
||||
}
|
||||
switch param.PathAs {
|
||||
case terms.AsRegexp:
|
||||
case term.AsRegexp:
|
||||
collections, err := oper.listCollectionsWithRegexp(ctx, param.Path)
|
||||
if err != nil {
|
||||
code := http.StatusInternalServerError
|
||||
@@ -562,7 +562,7 @@ func (oper *Operator) DeleteColletion(ctx context.Context, operatorID uuid.UUID,
|
||||
}
|
||||
res.Files = allfiles
|
||||
|
||||
case terms.AsPrefix:
|
||||
case term.AsPrefix:
|
||||
param.Path, err = cleanFilepath(param.Path)
|
||||
if err != nil {
|
||||
code := http.StatusInternalServerError
|
||||
|
||||
Reference in New Issue
Block a user