feat: add project creator role on register user (#222)

* feat: add project creator role on register user

* fix: better error message

* fix: tests
This commit is contained in:
Fabi
2020-06-15 14:57:19 +02:00
committed by GitHub
parent e63179514c
commit 8dd6082b17
7 changed files with 46 additions and 10 deletions

View File

@@ -85,7 +85,10 @@ func (a *Aggregate) Validate() error {
if a.resourceOwner == "" {
return errors.ThrowPreconditionFailed(nil, "MODEL-eBYUW", "resource owner not set")
}
if a.Precondition != nil && (a.Precondition.Query == nil || a.Precondition.Query.Validate() != nil || a.Precondition.Validation == nil) {
if a.Precondition != nil && (a.Precondition.Query == nil || a.Precondition.Validation == nil) {
if err := a.Precondition.Query.Validate(); err != nil {
return err
}
return errors.ThrowPreconditionFailed(nil, "MODEL-EEUvA", "invalid precondition")
}