Added api/classifications endpoint, requiring a new query
This commit is contained in:
1 parent
378ac59f41
commit
0e27d2b2f3
9 files changed
+186
-6
No files matched your search
+5
-2
@@ -20,7 +20,8 @@ type API struct {
|
||||
type Option func(*API)
|
||||
|
||||
// WithStore makes the API serve the opportunities in opportunityStore under
|
||||
// /opportunities. Without it there are no opportunity routes.
|
||||
// /opportunities, and their classifications under /classifications. Without
|
||||
// it there are neither.
|
||||
func WithStore(opportunityStore *store.Store) Option {
|
||||
return func(a *API) {
|
||||
a.store = opportunityStore
|
||||
@@ -46,10 +47,12 @@ func New(opts ...Option) *API {
|
||||
}
|
||||
|
||||
// Routes registers the API's routes on router (mounted under /api): its
|
||||
// description (see openapi.go), and the opportunities if it has a store.
|
||||
// description (see openapi.go), and the opportunities and classifications if
|
||||
// it has a store.
|
||||
func (a *API) Routes(router chi.Router) {
|
||||
docsRoutes(router)
|
||||
if a.store != nil {
|
||||
newOpportunityRoutes(a.store, a.events).Routes(router)
|
||||
newClassificationRoutes(a.store).Routes(router)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user