Skip to content

Commit 802f7e0

Browse files
committed
Update project schema attributes
Signed-off-by: Andres Tobon <andrest2455@gmail.com>
1 parent 2a67dc7 commit 802f7e0

File tree

20 files changed

+1046
-357
lines changed

20 files changed

+1046
-357
lines changed

cmd/project-api/design/project.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ var _ = Service("project-service", func() {
7676
ProjectSlugAttribute()
7777
ProjectDescriptionAttribute()
7878
ProjectNameAttribute()
79-
ProjectManagersAttribute()
80-
Required("slug", "description", "name", "managers")
79+
ProjectPublicAttribute()
80+
ProjectParentUIDAttribute()
81+
ProjectAuditorsAttribute()
82+
ProjectWritersAttribute()
83+
Required("slug", "description", "name")
8184
})
8285

8386
Result(Project)
@@ -162,8 +165,11 @@ var _ = Service("project-service", func() {
162165
ProjectSlugAttribute()
163166
ProjectDescriptionAttribute()
164167
ProjectNameAttribute()
165-
ProjectManagersAttribute()
166-
Required("slug", "description", "name", "managers")
168+
ProjectPublicAttribute()
169+
ProjectParentUIDAttribute()
170+
ProjectAuditorsAttribute()
171+
ProjectWritersAttribute()
172+
Required("slug", "description", "name")
167173
})
168174

169175
Result(Project)
@@ -179,12 +185,6 @@ var _ = Service("project-service", func() {
179185
Param("version:v")
180186
Param("id")
181187
})
182-
Body(func() {
183-
Attribute("slug")
184-
Attribute("description")
185-
Attribute("name")
186-
Attribute("managers")
187-
})
188188
Header("bearer_token:Authorization")
189189
Header("etag:ETag")
190190
Response(StatusOK)

cmd/project-api/design/types.go

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ var Project = Type("Project", func() {
1717
ProjectSlugAttribute()
1818
ProjectDescriptionAttribute()
1919
ProjectNameAttribute()
20-
ProjectManagersAttribute()
20+
ProjectPublicAttribute()
21+
ProjectParentUIDAttribute()
22+
ProjectAuditorsAttribute()
23+
ProjectWritersAttribute()
2124
})
2225

2326
//
@@ -55,9 +58,32 @@ func ProjectDescriptionAttribute() {
5558
})
5659
}
5760

58-
// ProjectManagersAttribute is the DSL attribute for a project managers.
59-
func ProjectManagersAttribute() {
60-
Attribute("managers", ArrayOf(String), "A list of project managers by their user IDs", func() {
61+
// ProjectPublicAttribute is the DSL attribute for a project public flag.
62+
func ProjectPublicAttribute() {
63+
Attribute("public", Boolean, "Whether the project is public", func() {
64+
Example(true)
65+
})
66+
}
67+
68+
// ProjectParentUIDAttribute is the DSL attribute for a project parent UID.
69+
func ProjectParentUIDAttribute() {
70+
Attribute("parent_uid", String, "The UID of the parent project, should be empty if there is none", func() {
71+
// No Format(FormatUUID) is included because this attribute can be an empty string if there is no parent project.
72+
// However, the attribute should in practice be a UUID. There is server code to validate this.
73+
Example("7cad5a8d-19d0-41a4-81a6-043453daf9ee")
74+
})
75+
}
76+
77+
// ProjectAuditorsAttribute is the DSL attribute for a project auditors.
78+
func ProjectAuditorsAttribute() {
79+
Attribute("auditors", ArrayOf(String), "A list of project auditors by their user IDs", func() {
80+
Example([]string{"user123", "user456"})
81+
})
82+
}
83+
84+
// ProjectWritersAttribute is the DSL attribute for a project writers.
85+
func ProjectWritersAttribute() {
86+
Attribute("writers", ArrayOf(String), "A list of project writers by their user IDs", func() {
6187
Example([]string{"user123", "user456"})
6288
})
6389
}

cmd/project-api/gen/http/cli/project_service/cli.go

Lines changed: 18 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/project-api/gen/http/openapi.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)