Skip to content

Commit

Permalink
Merge branch 'main' of github.com:HackRVA/memberdashboard into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dfirebaugh committed Mar 26, 2024
2 parents 1c6846b + 74faf5a commit 2a7c163
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 320 deletions.
48 changes: 0 additions & 48 deletions pkg/membermgr/routes/reports.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,55 +13,7 @@ type ReportsHTTPHandler interface {
}

func (r Router) setupReportsRoutes(reports ReportsHTTPHandler, accessControl rbac.AccessControl) {
// swagger:route GET /api/reports/membercounts stats membershipChartRequest
//
// Get Chart information of monthly member counts
//
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: getPaymentChartResponse
r.authedRouter.HandleFunc("/reports/membercounts", accessControl.Restrict(reports.GetMemberCountsCharts, []rbac.UserRole{rbac.Admin}))
// swagger:route GET /api/reports/access stats accessChartRequest
//
// Get Chart information of daily access event counts
//
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: getAccessStatsChartResponse
r.authedRouter.HandleFunc("/reports/access", accessControl.Restrict(reports.GetAccessStatsChart, []rbac.UserRole{rbac.Admin}))
// swagger:route GET /api/reports/churn stats
//
// Get Chart information of daily access event counts
//
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: getMemberChurnResponse
r.authedRouter.HandleFunc("/reports/churn", reports.GetMemberChurn)
}
179 changes: 0 additions & 179 deletions pkg/membermgr/routes/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,191 +18,12 @@ type ResourceHTTPHandler interface {
}

func (r Router) setupResourceRoutes(resource ResourceHTTPHandler, accessControl rbac.RBAC) {
// swagger:route GET /api/resource resource updateResourceRequest
// Returns a resource.
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: getResourceResponse

// swagger:route PUT /api/resource resource updateResourceRequest
//
// Updates a resource.
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: postResourceResponse

// swagger:route DELETE /api/resource resource deleteResourceRequest
//
// Deletes a resource.
//
// Consumes:
// - application/json
//
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200:
r.authedRouter.HandleFunc("/resource", accessControl.Restrict(resource.Resource, []rbac.UserRole{rbac.Admin})).Methods(http.MethodPut, http.MethodDelete, http.MethodGet)
// swagger:route GET /api/resource/status resource getResourceStatus
//
// Returns status of the resources.
//
// Returns the status of all resources.
// 0 = Good
// 1 = Out of Date
// 2 = Offline
//
// if the resource is out of date, it will attempt to push an update
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: getResourceStatusResponse
r.authedRouter.HandleFunc("/resource/status", accessControl.Restrict(resource.Status, []rbac.UserRole{rbac.Admin})).Methods(http.MethodGet)
// swagger:route POST /api/resource/register resource registerResourceRequest
//
// Updates a resource.
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: postResourceResponse
r.authedRouter.HandleFunc("/resource/register", accessControl.Restrict(resource.Register, []rbac.UserRole{rbac.Admin})).Methods(http.MethodPost)
// swagger:route POST /api/resource/member/bulk resource resourceBulkMemberRequest
//
// Adds multple members to a resource.
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: addMulitpleMembersToResourceResponse
r.authedRouter.HandleFunc("/resource/member/bulk", accessControl.Restrict(resource.AddMultipleMembersToResource, []rbac.UserRole{rbac.Admin})).Methods(http.MethodPost)
// swagger:route DELETE /api/resource/deleteacls resource resourceDeleteACLS
//
// Clears out all Resource ACLs on those devices
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: endpointSuccessResponse
r.authedRouter.HandleFunc("/resource/deleteacls", accessControl.Restrict(resource.DeleteResourceACL, []rbac.UserRole{rbac.Admin})).Methods(http.MethodDelete)
// swagger:route POST /api/resource/updateacls resource resourceUpdateACLS
//
// Attempts to send all members to a Resource
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
//
// Responses:
// 200: endpointSuccessResponse
r.authedRouter.HandleFunc("/resource/updateacls", accessControl.Restrict(resource.UpdateResourceACL, []rbac.UserRole{rbac.Admin})).Methods(http.MethodPost)
// swagger:route POST /api/resource/open resource openResourceRequest
//
// sends an MQTT message to open a resource
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: endpointSuccessResponse
r.authedRouter.HandleFunc("/resource/open", accessControl.Restrict(resource.Open, []rbac.UserRole{rbac.Admin})).Methods(http.MethodPost)
// swagger:route DELETE /api/resource/member resource resourceRemoveMemberRequest
//
// Removes a member from a resource.
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: removeMemberSuccessResponse
r.authedRouter.HandleFunc("/resource/member", accessControl.Restrict(resource.RemoveMember, []rbac.UserRole{rbac.Admin})).Methods(http.MethodDelete)
}
19 changes: 0 additions & 19 deletions pkg/membermgr/routes/router.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
// Package Classification Member Server API.
//
// Schemes: http, https
// Version: 0.0.1
// License: MIT http://opensource.org/licenses/MIT
//
// SecurityDefinitions:
// bearerAuth:
// type: apiKey
// in: header
// name: Authorization
// description: Enter your bearer token
// basicAuth:
// type: basic
// in: header
// name: Authorization
// description: Enter your basic auth credentials
//
// swagger:meta
package routes

import (
Expand Down
60 changes: 0 additions & 60 deletions pkg/membermgr/routes/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,68 +15,8 @@ type AuthHTTPHandler interface {
}

func (r Router) setupUserRoutes(userServer UserHTTPHandler, auth AuthHTTPHandler) {
// swagger:route GET /api/user user user
//
// Returns the current logged in user.
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Security:
// - bearerAuth:
// - basicAuth:
//
// Responses:
// 200: getUserResponse
r.authedRouter.HandleFunc("/user", userServer.GetUser)
// swagger:route POST /api/auth/login auth loginRequest
//
// Login
//
// Login accepts some json with the `email` and `password`
// and returns some json that has the token string
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Responses:
// 200: loginResponse
r.authedRouter.HandleFunc("/auth/login", auth.Login).Methods(http.MethodPost)
// swagger:route DELETE /api/auth/logout auth logoutRequest
//
// Logout
//
// Logout does not require a request body
//
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Responses:
// 200:
r.authedRouter.HandleFunc("/auth/logout", auth.Logout).Methods(http.MethodDelete)
// swagger:route POST /api/auth/register auth registerUserRequest
//
// Register a new user
//
// Register a new user of the app
//
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Responses:
// 200: endpointSuccessResponse
r.UnAuthedRouter.HandleFunc("/api/auth/register", auth.RegisterUser)
}
14 changes: 0 additions & 14 deletions pkg/membermgr/routes/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,5 @@ type VersionHTTPHandler interface {
}

func (r Router) setupVersionRoutes(versionServer VersionHTTPHandler) {
// swagger:route GET /api/version version Version
//
// Shows the current build's version information
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Schemes: http, https
//
// Responses:
// 200: versionResponse
r.UnAuthedRouter.HandleFunc("/api/version", versionServer.ServeHTTP)
}

0 comments on commit 2a7c163

Please sign in to comment.