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,21 +6,27 @@ import (
"net/http"
)
// Request struct for delete account
type DeleteRequest struct {
AccountID uint64 `url:"accountId"`
Permanently bool `url:"permanently,omitempty"`
// ID of account to delete
// Required: true
AccountID uint64 `url:"accountId"`
// Whether to completely delete the account
// Required: false
Permanently bool `url:"permanently,omitempty"`
}
func (arq DeleteRequest) Validate() error {
func (arq DeleteRequest) validate() error {
if arq.AccountID == 0 {
return errors.New("validation-error: field AccountID must be set")
}
return nil
}
// Delete completes delete an account from the system Returns true if account is deleted or was already deleted or never existed
func (a Account) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
err := req.Validate()
err := req.validate()
if err != nil {
return false, err
}