adding dboverview route, fixing add new location and add new room

This commit is contained in:
2022-04-09 22:27:26 -04:00
parent 25deaf43c8
commit c79dc69bb0
10 changed files with 274 additions and 53 deletions

View File

@@ -19,7 +19,7 @@ func (s *Server) GetServerConfig(c *fiber.Ctx) error {
func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
form, err := c.MultipartForm()
if err != nil {
s.Log.Err(err).Msgf("Unable to fetch locations: ", err)
s.Log.Err(err).Msgf("Unable to fetch new location form details: ", err)
return err
}
@@ -77,11 +77,16 @@ func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
}
// Parse all the other fields
description := ""
description = form.Value["Description"][0]
locNotes := ""
locNotes = form.Value["Notes"][0]
address := ""
address = form.Value["Address"][0]
if val, ok := form.Value["Address"]; ok {
address = val[0]
}
squareFeet := ""
squareFeet = form.Value["SquareFeet"][0]
@@ -97,13 +102,16 @@ func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
longitude = form.Value["Latitude"][0]
datePurchased := ""
datePurchased = form.Value["DatePurchased"][0]
if val, ok := form.Value["DatePurchased"]; ok {
datePurchased = val[0]
}
purchasePrice := ""
purchasePrice = form.Value["PurchasePrice"][0]
newLocation := Location{
Name: locName,
Description: description,
CoverPhoto: coverImageURL,
Address: address,
Latitude: latitude,