85 lines
1.4 KiB
Go
85 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"gosvc/httpserver"
|
|
"gosvc/validator"
|
|
)
|
|
|
|
type DeleteParams struct {
|
|
Path string
|
|
IsDir bool
|
|
}
|
|
|
|
func (d *DeleteParams) Validate() error {
|
|
return validator.WithIf(
|
|
d.Path == "", "Path is empty",
|
|
).Validate()
|
|
}
|
|
|
|
type GeneralParams struct {
|
|
SrcPath string
|
|
DstPath string
|
|
IsDir bool
|
|
}
|
|
|
|
func (g *GeneralParams) Validate() error {
|
|
return validator.ChainValidate(
|
|
validator.WithIf(
|
|
g.SrcPath == "", "SrcPath is empty",
|
|
),
|
|
validator.WithIf(
|
|
g.DstPath == "", "DstPath is empty",
|
|
),
|
|
)
|
|
}
|
|
|
|
type CopyParams struct {
|
|
GeneralParams
|
|
}
|
|
|
|
type RenameParams struct {
|
|
GeneralParams
|
|
}
|
|
|
|
func (s *Service) HandleUploadFile(
|
|
req *httpserver.Request,
|
|
resp *httpserver.Response,
|
|
) *httpserver.Response {
|
|
return resp.NoContent()
|
|
}
|
|
|
|
func (s *Service) HandleInfoFile(
|
|
req *httpserver.Request,
|
|
resp *httpserver.Response,
|
|
) *httpserver.Response {
|
|
return resp.NoContent()
|
|
}
|
|
|
|
func (s *Service) HandleDownloadFile(
|
|
req *httpserver.Request,
|
|
resp *httpserver.Response,
|
|
) *httpserver.Response {
|
|
return resp.NoContent()
|
|
}
|
|
|
|
func (s *Service) HandleDeleteFile(
|
|
req *httpserver.Request,
|
|
resp *httpserver.Response,
|
|
) *httpserver.Response {
|
|
return resp.NoContent()
|
|
}
|
|
|
|
func (s *Service) HandleRenameFile(
|
|
req *httpserver.Request,
|
|
resp *httpserver.Response,
|
|
) *httpserver.Response {
|
|
return resp.NoContent()
|
|
}
|
|
|
|
func (s *Service) HandleCopyFile(
|
|
req *httpserver.Request,
|
|
resp *httpserver.Response,
|
|
) *httpserver.Response {
|
|
return resp.NoContent()
|
|
}
|