This commit is contained in:
stSolo
2022-12-22 17:56:47 +03:00
parent 8712561853
commit d4b1ab7133
672 changed files with 28509 additions and 4419 deletions

View File

@@ -6,12 +6,18 @@ import (
"net/http"
)
// Request struct for restore a deleted account
type RestoreRequest struct {
// ID an account
// Required: true
AccountID uint64 `url:"accountId"`
Reason string `url:"reason"`
// Reason to restore
// Required: true
Reason string `url:"reason"`
}
func (arq RestoreRequest) Validate() error {
func (arq RestoreRequest) validate() error {
if arq.AccountID == 0 {
return errors.New("validation-error: field AccountID must be set")
}
@@ -22,8 +28,9 @@ func (arq RestoreRequest) Validate() error {
return nil
}
// Restore restores a deleted account
func (a Account) Restore(ctx context.Context, req RestoreRequest) (bool, error) {
err := req.Validate()
err := req.validate()
if err != nil {
return false, err
}
@@ -36,4 +43,4 @@ func (a Account) Restore(ctx context.Context, req RestoreRequest) (bool, error)
}
return true, nil
}
}