fix: Project checks (#141)

* project validations

* unique project on resourceowner
This commit is contained in:
Fabi
2020-05-28 06:53:12 +02:00
committed by GitHub
parent d447f68d78
commit 2758bf30b1
7 changed files with 191 additions and 14 deletions

View File

@@ -21,6 +21,15 @@ type Project struct {
Grants []*ProjectGrant `json:"-"`
}
func GetProject(projects []*Project, id string) (int, *Project) {
for i, p := range projects {
if p.AggregateID == id {
return i, p
}
}
return -1, nil
}
func (p *Project) Changes(changed *Project) map[string]interface{} {
changes := make(map[string]interface{}, 1)
if changed.Name != "" && p.Name != changed.Name {