Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fbe7a01

Browse files
committed
API finalization + tests
Signed-off-by: Danny Kopping <[email protected]>
1 parent 952821b commit fbe7a01

File tree

11 files changed

+573
-58
lines changed

11 files changed

+573
-58
lines changed

coderd/apidoc/docs.go

+111
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

+101
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/coderd.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,12 @@ func New(options *Options) *API {
10501050
})
10511051
r.Get("/gitsshkey", api.gitSSHKey)
10521052
r.Put("/gitsshkey", api.regenerateGitSSHKey)
1053+
r.Route("/notifications", func(r chi.Router) {
1054+
r.Route("/preferences", func(r chi.Router) {
1055+
r.Get("/", api.userNotificationPreferences)
1056+
r.Put("/", api.putUserNotificationPreferences)
1057+
})
1058+
})
10531059
})
10541060
})
10551061
})
@@ -1252,10 +1258,6 @@ func New(options *Options) *API {
12521258
r.Route("/templates", func(r chi.Router) {
12531259
r.Get("/system", api.systemNotificationTemplates)
12541260
})
1255-
r.Route("/preferences", func(r chi.Router) {
1256-
r.Get("/", api.userNotificationPreferences)
1257-
r.Put("/", api.putUserNotificationPreferences)
1258-
})
12591261
})
12601262
})
12611263

coderd/database/modelmethods.go

+4
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ func (a GetOAuth2ProviderAppsByUserIDRow) RBACObject() rbac.Object {
290290
return a.OAuth2ProviderApp.RBACObject()
291291
}
292292

293+
func (n NotificationPreference) RBACObject() rbac.Object {
294+
return rbac.ResourceNotificationPreference.WithOwner(n.UserID.String())
295+
}
296+
293297
type WorkspaceAgentConnectionStatus struct {
294298
Status WorkspaceAgentStatus `json:"status"`
295299
FirstConnectedAt *time.Time `json:"first_connected_at"`

0 commit comments

Comments
 (0)