fixing locimage paths, starting room work

This commit is contained in:
2022-01-08 22:50:46 -05:00
parent e84f57692a
commit c811a8e2b9
10 changed files with 258 additions and 41 deletions

View File

@@ -80,3 +80,143 @@
{"level":"debug","time":"2021-12-27T21:40:29-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2021-12-27T21:40:29-05:00","message":"Database and Config loaded, starting webserver..."}
{"logtype":"webserver", "pid":"20308", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations/1"}
{"level":"info","time":"2022-01-08T21:51:07-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-01-08T21:51:07-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-01-08T21:51:07-05:00","message":"Database and Config loaded, starting webserver..."}
{"logtype":"webserver", "pid":"22268", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"debug","time":"2022-01-08T21:51:34-05:00","message":"Returning Locations: [{ID:1 Name:Location1 Description: CoverPhoto:./app/photos/locations/Location1/Location1_cover.png Photos:[./app/photos/locations/Location1/Location1_0.png ./app/photos/locations/Location1/Location1_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"22268", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"22268", "requestid":"", "status":"404", "method":"GET", "path":"/photos/locations/Location1/app/photos/locations/Location1/Location1_cover.png"}
{"level":"info","time":"2022-01-08T21:53:50-05:00","message":"Deleting location from database: %!(EXTRA main.Location={1 Location1 ./app/photos/locations/Location1/Location1_cover.png [./app/photos/locations/Location1/Location1_0.png ./app/photos/locations/Location1/Location1_1.png] [] Notes for my location!})"}
{"logtype":"webserver", "pid":"22268", "requestid":"", "status":"200", "method":"DELETE", "path":"/api/locations/1"}
{"level":"info","time":"2022-01-08T21:58:01-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-01-08T21:58:01-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-01-08T21:58:01-05:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-01-08T21:58:07-05:00","message":"Adding new location to database: %!(EXTRA main.Location={0 Location1 Location1/Location1_cover.png [Location1/Location1_0.png Location1/Location1_1.png] [] Notes for my location!})"}
{"level":"debug","time":"2022-01-08T21:58:07-05:00","message":"Adding new location: {0 Location1 Location1/Location1_cover.png [Location1/Location1_0.png Location1/Location1_1.png] [] Notes for my location!}"}
{"logtype":"webserver", "pid":"7868", "requestid":"", "status":"200", "method":"POST", "path":"/api/locations/new"}
{"level":"error","time":"2022-01-08T21:58:10-05:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"7868", "requestid":"", "status":"500", "method":"GET", "path":"/api/locations/1"}
{"level":"debug","time":"2022-01-08T21:58:18-05:00","message":"Returning Locations: [{ID:2 Name:Location1 Description: CoverPhoto:Location1/Location1_cover.png Photos:[Location1/Location1_0.png Location1/Location1_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"7868", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-01-08T21:58:30-05:00","message":"Returning Locations: [{ID:2 Name:Location1 Description: CoverPhoto:Location1/Location1_cover.png Photos:[Location1/Location1_0.png Location1/Location1_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"7868", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"7868", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"debug","time":"2022-01-08T21:58:31-05:00","message":"Returning Locations: [{ID:2 Name:Location1 Description: CoverPhoto:Location1/Location1_cover.png Photos:[Location1/Location1_0.png Location1/Location1_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"7868", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"7868", "requestid":"", "status":"404", "method":"GET", "path":"/photos/locations/Location1/Location1/Location1_cover.png"}
{"level":"info","time":"2022-01-08T22:00:24-05:00","message":"Deleting location from database: %!(EXTRA main.Location={2 Location1 Location1/Location1_cover.png [Location1/Location1_0.png Location1/Location1_1.png] [] Notes for my location!})"}
{"logtype":"webserver", "pid":"7868", "requestid":"", "status":"200", "method":"DELETE", "path":"/api/locations/2"}
{"level":"info","time":"2022-01-08T22:00:30-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-01-08T22:00:30-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-01-08T22:00:30-05:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-01-08T22:00:34-05:00","message":"Adding new location to database: %!(EXTRA main.Location={0 Location1 Location1_cover.png [Location1_0.png Location1_1.png] [] Notes for my location!})"}
{"level":"debug","time":"2022-01-08T22:00:34-05:00","message":"Adding new location: {0 Location1 Location1_cover.png [Location1_0.png Location1_1.png] [] Notes for my location!}"}
{"logtype":"webserver", "pid":"32476", "requestid":"", "status":"200", "method":"POST", "path":"/api/locations/new"}
{"level":"debug","time":"2022-01-08T22:00:39-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"32476", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-01-08T22:00:46-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"32476", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"32476", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"debug","time":"2022-01-08T22:00:47-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"32476", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"32476", "requestid":"", "status":"200", "method":"GET", "path":"/photos/locations/Location1/Location1_cover.png"}
{"logtype":"webserver", "pid":"32476", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"32476", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations/3"}
{"level":"info","time":"2022-01-08T22:09:01-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-01-08T22:09:01-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-01-08T22:09:01-05:00","message":"Database and Config loaded, starting webserver..."}
{"level":"debug","time":"2022-01-08T22:09:09-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/Location1/Location1_cover.png"}
{"level":"info","time":"2022-01-08T22:10:08-05:00","message":"Adding new location to database: %!(EXTRA main.Location={0 Location4 Location4_cover.png [Location4_0.png Location4_1.png] [] Notes for my location!})"}
{"level":"debug","time":"2022-01-08T22:10:08-05:00","message":"Adding new location: {0 Location4 Location4_cover.png [Location4_0.png Location4_1.png] [] Notes for my location!}"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"POST", "path":"/api/locations/new"}
{"level":"debug","time":"2022-01-08T22:10:11-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-01-08T22:10:15-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"debug","time":"2022-01-08T22:10:17-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/Location1/Location1_cover.png"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/photos/locations/Location4/Location4_cover.png"}
{"level":"debug","time":"2022-01-08T22:17:30-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/undefined"}
{"level":"error","time":"2022-01-08T22:18:34-05:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/1"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"debug","time":"2022-01-08T22:27:19-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/Location1/Location1_cover.png"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/Location4/Location4_cover.png"}
{"level":"error","time":"2022-01-08T22:27:23-05:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/3"}
{"level":"error","time":"2022-01-08T22:27:58-05:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/3"}
{"level":"debug","time":"2022-01-08T22:28:00-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-01-08T22:28:34-05:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-01-08T22:28:44-05:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"404", "method":"GET", "path":"/api/api/rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-01-08T22:29:49-05:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"404", "method":"GET", "path":"/api/api/rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-01-08T22:31:07-05:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-01-08T22:32:40-05:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-01-08T22:33:04-05:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-01-08T22:34:50-05:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-01-08T22:35:43-05:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"debug","time":"2022-01-08T22:36:03-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/Location4/Location4_cover.png"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/Location1/Location1_cover.png"}
{"level":"error","time":"2022-01-08T22:36:04-05:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/3"}
{"level":"error","time":"2022-01-08T22:36:39-05:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/3"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"debug","time":"2022-01-08T22:36:46-05:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"error","time":"2022-01-08T22:36:49-05:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/3"}
{"level":"error","time":"2022-01-08T22:37:08-05:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/3"}
{"level":"error","time":"2022-01-08T22:37:13-05:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/1"}
{"level":"error","time":"2022-01-08T22:37:36-05:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"22076", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/3"}
{"level":"info","time":"2022-01-08T22:43:16-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-01-08T22:43:16-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-01-08T22:43:16-05:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-01-08T22:48:14-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-01-08T22:48:14-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-01-08T22:48:14-05:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-01-08T22:49:52-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-01-08T22:49:52-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-01-08T22:49:52-05:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-01-08T22:50:04-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-01-08T22:50:04-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-01-08T22:50:04-05:00","message":"Database and Config loaded, starting webserver..."}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 KiB

View File

@@ -19,13 +19,16 @@ type Location struct {
// Room is a containerized area at a location
type Room struct {
ID int `storm:"id,increment,index"`
ID int `storm:"id,increment,index"`
Name string `storm:"unique"`
Description string
CoverPhoto string // A "cover photo" for the room
Photos []string // A list of additional photos for the room
Name string `storm:"unique"`
Description string
LocationID int //Which location room is assigned to
Notes string
Cabinets []Cabinet
Items []Item
LocationID int //Which location room is assigned to
}
// Cabinet is a containerized area in a room
@@ -42,7 +45,7 @@ type Item struct {
ID int `storm:"id, increment"`
RoomID int // Room ID that item is assigned to
CoverPhoto string // A "cover photo" for the item
Photos []string // A list of additional photos for the room
Photos []string // A list of additional photos for the item
Count int // If item has duplicates
Name string
Product string

View File

@@ -33,7 +33,7 @@ function App() {
useEffect(() => {
navigate("/")// Reset to homepage on new load anywhere in the app
// navigate("/")// Reset to homepage on new load anywhere in the app
setIsLoading(true)
async function fetchSettings() {
backendAPI.get('/config').then(results => {
@@ -63,26 +63,20 @@ function App() {
}, [])
useEffect(() => {
console.log("Page Change!", currentPage)
}, [currentPage])
function showPage() {
switch (currentPage.path) {
case "home":
return <HomePage />
case "locations":
console.log("RETURNING LOCATIONS: ", currentPage)
return <Locations setCurrentPage={setCurrentPage} id={currentPage.id}/>
case "rooms":
console.log("RETURNING ROOMS: ", currentPage)
return <RoomsPage setCurrentPage={setCurrentPage} id={currentPage.id} />
default:
break;
}
}
// function showPage() {
// switch (currentPage.path) {
// case "home":
// return <HomePage />
// case "locations":
// console.log("RETURNING LOCATIONS: ", currentPage)
// return <Locations setCurrentPage={setCurrentPage} id={currentPage.id}/>
// case "rooms":
// console.log("RETURNING ROOMS: ", currentPage)
// return <RoomsPage setCurrentPage={setCurrentPage} id={currentPage.id} />
// default:
// break;
// }
// }
return (

View File

@@ -1,6 +1,7 @@
import React, {useState, useEffect, useContext, createContext} from 'react';
import { APIContext } from '../../App';
import { Text, Loader, Center, Card, Image, Badge, Button, SimpleGrid, Group } from '@mantine/core'
import { useNavigate } from "react-router-dom";
import { useNotifications } from '@mantine/notifications';
import { backendAPI } from '../../services/backend-api';
@@ -14,6 +15,7 @@ function LocationsPage(props) {
const serverConfig = useContext(APIContext);
const notifications = useNotifications();
const navigate = useNavigate();
useEffect(() => {
console.log("LOADING LOCATIONS PAGE!")
@@ -47,7 +49,7 @@ function LocationsPage(props) {
<Center><Text>Locations</Text></Center>
<SimpleGrid cols={4} spacing="xl">
{ locations.map((location, idx) =>
<Card key={`${idx} - ${location.ID}`} component="a" onClick={(e) => {props.setCurrentPage({"path": "rooms", "id": location.ID})}} shadow="sm" padding="md">
<Card key={`${idx} - ${location.ID}`} component="a" onClick={(e) => {navigate("/rooms", { state: { locationID: location.ID}})}} shadow="sm" padding="md">
<Card.Section>
{location.CoverPhoto ? <Image src={`${serverConfig.baseURL}/photos/locations/${location.Name}/${location.CoverPhoto}`}></Image> : <Text>No Photo</Text>}
</Card.Section>

View File

@@ -1,6 +1,7 @@
import React, {useState, useEffect, useContext, createContext} from 'react';
import { APIContext } from '../../App';
import { Text, Loader, Center, Card, Image, Badge, Button, SimpleGrid, Group } from '@mantine/core'
import { useLocation } from "react-router-dom";
import { useNotifications } from '@mantine/notifications';
import { backendAPI } from '../../services/backend-api';
@@ -9,23 +10,24 @@ import { backendAPI } from '../../services/backend-api';
function RoomsPage(props) {
// const [opened, setOpened] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const [rooms, setLocations] = useState([])
const [rooms, setRooms] = useState([])
const serverConfig = useContext(APIContext);
const notifications = useNotifications();
const {state} = useLocation();
useEffect(() => {
setIsLoading(true)
async function fetchSettings() {
let url = `/rooms`
console.log("CURRENT PAGE IN ROOMS: ", props.id)
if (props.id !== -1) {
url = `/rooms/${props.id}`
let url = `rooms`
console.log("CURRENT STATE: ", state)
if (state) {
url = `rooms/${state.locationID}`
}
backendAPI.get(url).then(results => {
console.log("CONFIG IN LOCATIONS: ", serverConfig)
setLocations(results.data)
console.log("ROOMS: ", results)
setRooms(results.data)
setIsLoading(false)
}).catch(err => {
notifications.showNotification({
@@ -47,9 +49,10 @@ function RoomsPage(props) {
return (
<>
<Center>{ isLoading && <Loader size="xl" variant="bars" />}</Center>
<Center><Text>Rooms</Text></Center>
<SimpleGrid cols={4} spacing="xl">
{ rooms.map((room, idx) =>
<Card key={`${room.ID}`} component="a" onClick={(e) => {props.setCurrentPage({"path": "rooms", "id": room.ID})}} shadow="sm" padding="md">
<Card key={`${room.ID}`} component="a" onClick={(e) => {}} shadow="sm" padding="md">
<Card.Section>
{room.CoverPhoto ? <Image src={`${serverConfig.baseURL}/photos/rooms/${room.Name}/${room.CoverPhoto}`}></Image> : <Text>No Photo</Text>}
</Card.Section>

View File

@@ -35,7 +35,7 @@ func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
if err != nil {
return err
}
var photoPathsList []string
var photoURLsList []string
for i, photo := range locAdditionalPhotos {
src, err := photo.Open()
if err != nil {
@@ -44,7 +44,8 @@ func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
defer src.Close()
photoPath := filepath.ToSlash(s.Config.Server.LocationPhotoDir + locName + "/" + locName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename))
photoPathsList = append(photoPathsList, photoPath)
photoURL := locName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename)
photoURLsList = append(photoURLsList, photoURL)
photoData, err := io.ReadAll(src)
if err != nil {
return err
@@ -56,6 +57,8 @@ func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
// saving the uploaded image to our images dir
coverImagePath := filepath.ToSlash(s.Config.Server.LocationPhotoDir + locName + "/" + locName + "_cover" + filepath.Ext(locPhoto.Filename))
// Creating the URL to retrieve photo
coverImageURL := locName + "_cover" + filepath.Ext(locPhoto.Filename)
src, err := locPhoto.Open()
if err != nil {
return err
@@ -72,8 +75,8 @@ func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
}
newLocation := Location{
Name: locName,
CoverPhoto: coverImagePath,
Photos: photoPathsList,
CoverPhoto: coverImageURL,
Photos: photoURLsList,
Notes: locNotes,
}
err = s.AddLocation(newLocation)
@@ -126,6 +129,77 @@ func (s *Server) DeleteLocationHandler(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).SendString(fmt.Sprintf("Location Deleted! %d", locID))
}
// Add a new location
func (s *Server) AddNewRoomHandler(c *fiber.Ctx) error {
form, err := c.MultipartForm()
if err != nil {
s.Log.Err(err).Msgf("Unable to fetch rooms: ", err)
return err
}
roomName := form.Value["Name"][0]
roomPhoto := form.File["CoverPhoto"][0]
if err != nil {
s.Log.Err(err).Msgf("Unable to get CoverPhoto for Room: ", err)
return err
}
roomAdditionalPhotos := form.File["AdditionalPhotos"]
// Create the directory for this location to store the photos
err = os.MkdirAll(s.Config.Server.LocationPhotoDir+roomName, 0755)
if err != nil {
return err
}
var photoURLsList []string
for i, photo := range roomAdditionalPhotos {
src, err := photo.Open()
if err != nil {
return err
}
defer src.Close()
photoPath := filepath.ToSlash(s.Config.Server.LocationPhotoDir + roomName + "/" + roomName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename))
photoURL := roomName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename)
photoURLsList = append(photoURLsList, photoURL)
photoData, err := io.ReadAll(src)
if err != nil {
return err
}
os.WriteFile(photoPath, photoData, 0644)
}
// create files on server for all uploads
locNotes := form.Value["Notes"][0]
// saving the uploaded image to our images dir
coverImagePath := filepath.ToSlash(s.Config.Server.LocationPhotoDir + roomName + "/" + roomName + "_cover" + filepath.Ext(roomPhoto.Filename))
// Creating the URL to retrieve photo
coverImageURL := roomName + "_cover" + filepath.Ext(roomPhoto.Filename)
src, err := roomPhoto.Open()
if err != nil {
return err
}
defer src.Close()
coverImageData, err := io.ReadAll(src)
if err != nil {
s.Log.Err(err).Msgf("Unable to read cover photo file: ", err)
return err
}
err = os.WriteFile(coverImagePath, coverImageData, 0644)
if err != nil {
return err
}
newLocation := Location{
Name: roomName,
CoverPhoto: coverImageURL,
Photos: photoURLsList,
Notes: locNotes,
}
err = s.AddLocation(newLocation)
if err != nil {
return err
}
s.Log.Debug().Msgf("Adding new location: %v", newLocation)
return c.Status(fiber.StatusOK).SendString(fmt.Sprintf("New Location Created! %s", newLocation.Name))
}
// GetAllRoomsHandler gets all of the rooms in the db
func (s *Server) GetAllRoomsHandler(c *fiber.Ctx) error {
rooms, err := s.GetAllRooms()

View File

@@ -97,11 +97,12 @@ func main() {
// Location Routes
server.WebServer.Get("/api/locations", server.GetAllLocationsHandler)
server.WebServer.Get("/api/locations/:locID", server.GetSingleLocationHandler)
server.WebServer.Post("api/locations/new", server.AddNewLocationHandler)
server.WebServer.Delete("api/locations/:locID", server.DeleteLocationHandler)
server.WebServer.Post("/api/locations/new", server.AddNewLocationHandler)
server.WebServer.Delete("/api/locations/:locID", server.DeleteLocationHandler)
// Room Routes
server.WebServer.Get("/api/rooms", server.GetAllRoomsHandler)
server.WebServer.Get("/api/rooms/:locID", server.GetRoomsAtLocationHandler)
server.WebServer.Post("/api/rooms/new", server.AddNewRoomHandler)
fmt.Println("Everything ready, starting server! ", fmt.Sprintf(":%s", server.Config.Server.Port))
server.WebServer.Listen(fmt.Sprintf(":%s", server.Config.Server.Port))
}