add bookingHandler

This commit is contained in:
SowinskiBraeden committed 2022-10-24 09:15:05 -07:00
1 parent d70b69f79b
commit 7dcff7adac
3 files changed
+64 -4

No files matched your search

+4
View File
@@ -36,6 +36,7 @@ func (a *App) New() *mux.Router {
apiCreate := r.PathPrefix("/api/v1").Subrouter()
// Data handlers, create, delete, update etc.
apiCreate.Handle("/cow/{cow_id}", api.Middleware(http.HandlerFunc(cow.CowByIDHandler))).Methods("GET") // By Object ID not Cow Name
apiCreate.Handle("/cows", api.Middleware(http.HandlerFunc(cow.CowHandler))).Methods("GET") // Returns all cows
apiCreate.Handle("/cows", api.Middleware(http.HandlerFunc(cow.CowHandlerQuery))).Methods("POST") // Returns list of cows based of name query
@@ -50,6 +51,9 @@ func (a *App) New() *mux.Router {
apiCreate.Handle("/devices/new", api.Middleware(http.HandlerFunc(device.NewDeviceHandler))).Methods("POST") // create new device
apiCreate.Handle("/devices/update/{device_id}", api.Middleware(http.HandlerFunc(device.UpdateDeviceHandler))).Methods("POST") // Update Device by Object ID
// Booking handling
apiCreate.Handle("/cow/book/{cow_id}", api.Middleware(http.HandlerFunc(cow.BookingHandler))).Methods("POST") // Add booking to cow by ID
return r
}