adding dboverview route, fixing add new location and add new room
This commit is contained in:
BIN
app/files/locations/Location0/Location0_cover.png
Normal file
BIN
app/files/locations/Location0/Location0_cover.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 349 KiB |
Binary file not shown.
Before Width: | Height: | Size: 536 KiB After Width: | Height: | Size: 349 KiB |
@@ -165,3 +165,138 @@
|
|||||||
{"level":"info","time":"2022-04-08T22:50:26-04:00","message":"Configuration loaded successfully..."}
|
{"level":"info","time":"2022-04-08T22:50:26-04:00","message":"Configuration loaded successfully..."}
|
||||||
{"level":"debug","time":"2022-04-08T22:50:26-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
{"level":"debug","time":"2022-04-08T22:50:26-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
{"level":"info","time":"2022-04-08T22:50:26-04:00","message":"Database and Config loaded, starting webserver..."}
|
{"level":"info","time":"2022-04-08T22:50:26-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T17:12:44-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T17:12:44-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T17:12:44-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T17:12:44-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T17:12:44-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T17:12:44-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T17:14:28-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T17:14:28-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T17:14:28-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:21:48-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:21:48-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:21:48-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:21:49-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:21:49-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:21:49-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:22:27-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:22:27-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:22:27-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:26:20-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:26:20-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:26:20-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:27:06-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:27:06-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:27:06-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:28:54-04:00","message":"Getting all Rooms"}
|
||||||
|
{"logtype":"webserver", "pid":"27100", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
|
||||||
|
{"logtype":"webserver", "pid":"27100", "requestid":"", "status":"404", "method":"GET", "path":"/photos/locations/Location4/Kitchen/Kitchen_cover.png"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:29:20-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:29:20-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:29:20-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:29:25-04:00","message":"Returning Locations: []"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:31:16-04:00","message":"Returning Locations: []"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:31:51-04:00","message":"Returning Locations: []"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:35:18-04:00","message":"Returning Locations: []"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:35:33-04:00","message":"Getting all Rooms"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:35:35-04:00","message":"Returning Locations: []"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:35:39-04:00","message":"Getting all Rooms"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:35:40-04:00","message":"Returning Locations: []"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:35:51-04:00","message":"Returning Locations: []"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:35:53-04:00","message":"Returning Locations: []"}
|
||||||
|
{"logtype":"webserver", "pid":"26572", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:42:08-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:42:08-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:42:08-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:42:16-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:42:16-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:42:16-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:52:51-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:52:51-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:52:51-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:52:56-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:52:56-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:52:56-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:54:17-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:54:17-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:54:17-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:54:17-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:54:17-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:54:17-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T21:56:14-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T21:56:14-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T21:56:14-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T22:03:09-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:03:09-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:03:09-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T22:04:01-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:04:01-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:04:01-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T22:04:06-04:00","message":"Adding new location to database: %!(EXTRA main.Location={0 Location10 This is my test description10 Notes for my location!10 2400 120N 120N 125000 Location10_cover.png [] [] []})"}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:04:06-04:00","message":"Adding new location: {0 Location10 This is my test description10 Notes for my location!10 2400 120N 120N 125000 Location10_cover.png [] [] []}"}
|
||||||
|
{"logtype":"webserver", "pid":"24776", "requestid":"", "status":"200", "method":"POST", "path":"/api/locations/new"}
|
||||||
|
{"logtype":"webserver", "pid":"24776", "requestid":"", "status":"404", "method":"GET", "path":"/api/overview"}
|
||||||
|
{"level":"error","time":"2022-04-09T22:04:51-04:00","message":"Failed to get last added location: provided target must be a pointer to slice "}
|
||||||
|
{"logtype":"webserver", "pid":"24776", "requestid":"", "status":"500", "method":"GET", "path":"/api/overview/all"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:05:20-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:05:20-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:05:20-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T22:07:38-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:07:38-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:07:38-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"logtype":"webserver", "pid":"30140", "requestid":"", "status":"200", "method":"GET", "path":"/api/overview/all"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:09:43-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:09:43-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:09:43-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"logtype":"webserver", "pid":"23428", "requestid":"", "status":"200", "method":"GET", "path":"/api/overview/all"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:12:03-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:12:03-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:12:03-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"logtype":"webserver", "pid":"31068", "requestid":"", "status":"200", "method":"GET", "path":"/api/overview/all"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:12:47-04:00","message":"Adding new location to database: %!(EXTRA main.Location={0 Location0 This is my test description0 Notes for my location!0 2500 120N 120N 125000 Location0_cover.png [] [] []})"}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:12:48-04:00","message":"Adding new location: {0 Location0 This is my test description0 Notes for my location!0 2500 120N 120N 125000 Location0_cover.png [] [] []}"}
|
||||||
|
{"logtype":"webserver", "pid":"31068", "requestid":"", "status":"200", "method":"POST", "path":"/api/locations/new"}
|
||||||
|
{"logtype":"webserver", "pid":"31068", "requestid":"", "status":"200", "method":"GET", "path":"/api/overview/all"}
|
||||||
|
{"logtype":"webserver", "pid":"31068", "requestid":"", "status":"200", "method":"GET", "path":"/api/overview/all"}
|
||||||
|
{"logtype":"webserver", "pid":"31068", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:13:43-04:00","message":"Returning Locations: [{ID:1 Name:Location10 Description:This is my test description10 Notes:Notes for my location!10 Address: SquareFeet:2400 Latitude:120N Longitude:120N DatePurchased: PurchasePrice:125000 CurrentValue: CoverPhoto:Location10_cover.png Photos:[] Files:[] Rooms:[]} {ID:2 Name:Location0 Description:This is my test description0 Notes:Notes for my location!0 Address: SquareFeet:2500 Latitude:120N Longitude:120N DatePurchased: PurchasePrice:125000 CurrentValue: CoverPhoto:Location0_cover.png Photos:[] Files:[] Rooms:[]}]"}
|
||||||
|
{"logtype":"webserver", "pid":"31068", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:14:04-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:14:04-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:14:04-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T22:17:33-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:17:33-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:17:33-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T22:24:48-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:24:48-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:24:48-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"error","time":"2022-04-09T22:24:52-04:00","message":"Failed to get all cabinets by ID: unknown tag "}
|
||||||
|
{"logtype":"webserver", "pid":"22260", "requestid":"", "status":"500", "method":"GET", "path":"/api/overview/all"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:25:33-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:25:33-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:25:33-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"error","time":"2022-04-09T22:25:38-04:00","message":"Failed to get all cabinets by ID: unknown tag "}
|
||||||
|
{"logtype":"webserver", "pid":"31072", "requestid":"", "status":"500", "method":"GET", "path":"/api/overview/all"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:25:58-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:25:58-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:25:58-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"level":"info","time":"2022-04-09T22:26:05-04:00","message":"Adding new location to database: %!(EXTRA main.Location={0 Location0 This is my test description0 Notes for my location!0 2500 120N 120N 125000 Location0_cover.png [] [] []})"}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:26:05-04:00","message":"Adding new location: {0 Location0 This is my test description0 Notes for my location!0 2500 120N 120N 125000 Location0_cover.png [] [] []}"}
|
||||||
|
{"logtype":"webserver", "pid":"9860", "requestid":"", "status":"200", "method":"POST", "path":"/api/locations/new"}
|
||||||
|
{"level":"error","time":"2022-04-09T22:26:09-04:00","message":"Failed to get all cabinets by ID: unknown tag "}
|
||||||
|
{"logtype":"webserver", "pid":"9860", "requestid":"", "status":"500", "method":"GET", "path":"/api/overview/all"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:26:38-04:00","message":"Configuration loaded successfully..."}
|
||||||
|
{"level":"debug","time":"2022-04-09T22:26:38-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/files/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
|
||||||
|
{"level":"info","time":"2022-04-09T22:26:38-04:00","message":"Database and Config loaded, starting webserver..."}
|
||||||
|
{"logtype":"webserver", "pid":"12712", "requestid":"", "status":"200", "method":"GET", "path":"/api/overview/all"}
|
||||||
|
@@ -38,7 +38,7 @@ type Room struct {
|
|||||||
|
|
||||||
// Cabinet is a containerized area in a room
|
// Cabinet is a containerized area in a room
|
||||||
type Cabinet struct {
|
type Cabinet struct {
|
||||||
ID int `storm:"id, increment"`
|
ID int `storm:"id,increment,index"`
|
||||||
RoomID int // Room ID that the cabinet is assigned to
|
RoomID int // Room ID that the cabinet is assigned to
|
||||||
RoomName string // Room name cabinet belongs to
|
RoomName string // Room name cabinet belongs to
|
||||||
CoverPhoto string // A "Cover photo" for this item
|
CoverPhoto string // A "Cover photo" for this item
|
||||||
@@ -49,7 +49,7 @@ type Cabinet struct {
|
|||||||
|
|
||||||
// Item is contained inside a room or cabinet
|
// Item is contained inside a room or cabinet
|
||||||
type Item struct {
|
type Item struct {
|
||||||
ID int `storm:"id, increment"`
|
ID int `storm:"id,increment,index"`
|
||||||
LocType string // Can be Room or Cabinet to show where it is stored
|
LocType string // Can be Room or Cabinet to show where it is stored
|
||||||
RoomID int // Room ID that item is assigned to (can also be in a cabinet)
|
RoomID int // Room ID that item is assigned to (can also be in a cabinet)
|
||||||
RoomName string // Room name that item is assigned to
|
RoomName string // Room name that item is assigned to
|
||||||
@@ -66,3 +66,15 @@ type Item struct {
|
|||||||
DatePurchased string
|
DatePurchased string
|
||||||
Files []string //filepath to any files relevant to this item
|
Files []string //filepath to any files relevant to this item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DatabaseOverview provides some details about the database
|
||||||
|
type DatabaseOverview struct {
|
||||||
|
NumLocations int
|
||||||
|
LastAddedLocation *Location
|
||||||
|
NumRooms int
|
||||||
|
LastAddedRoom *Room
|
||||||
|
NumCabinets int
|
||||||
|
LastAddedCabinet *Cabinet
|
||||||
|
NumItems int
|
||||||
|
LastAddedItem *Item
|
||||||
|
}
|
||||||
|
@@ -67,7 +67,7 @@ const useStyles = createStyles((theme) => ({
|
|||||||
initiallyOpened: true,
|
initiallyOpened: true,
|
||||||
links: [
|
links: [
|
||||||
{ label: 'View Rooms', link: '/rooms' },
|
{ label: 'View Rooms', link: '/rooms' },
|
||||||
{ label: 'Previous releases', link: '/' },
|
{ label: 'Add New Room', link: '/rooms/new' },
|
||||||
{ label: 'Releases schedule', link: '/' },
|
{ label: 'Releases schedule', link: '/' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@@ -3,7 +3,7 @@ import { useAtom } from 'jotai'
|
|||||||
import { serverConfigAtom } from '../../state/main';
|
import { serverConfigAtom } from '../../state/main';
|
||||||
import { HiPlus } from 'react-icons/hi'
|
import { HiPlus } from 'react-icons/hi'
|
||||||
import { Loader, Center, SimpleGrid, Title, Group, Button } from '@mantine/core'
|
import { Loader, Center, SimpleGrid, Title, Group, Button } from '@mantine/core'
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useNotifications } from '@mantine/notifications';
|
import { useNotifications } from '@mantine/notifications';
|
||||||
|
|
||||||
|
|
||||||
@@ -17,6 +17,8 @@ function LocationsPage() {
|
|||||||
const [locations, setLocations] = useState([])
|
const [locations, setLocations] = useState([])
|
||||||
const [serverConfig] = useAtom(serverConfigAtom)
|
const [serverConfig] = useAtom(serverConfigAtom)
|
||||||
|
|
||||||
|
let navigate = useNavigate();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const notifications = useNotifications();
|
const notifications = useNotifications();
|
||||||
@@ -51,7 +53,7 @@ function LocationsPage() {
|
|||||||
<>
|
<>
|
||||||
<Center>{ isLoading && <Loader size="xl" variant="bars" />}</Center>
|
<Center>{ isLoading && <Loader size="xl" variant="bars" />}</Center>
|
||||||
<Center><Title order={1}>Locations</Title></Center>
|
<Center><Title order={1}>Locations</Title></Center>
|
||||||
<Button leftIcon={<HiPlus />}>Add New Location</Button>
|
<Button leftIcon={<HiPlus />} onClick={(e) => {navigate("/locations/new")}}>Add New Location</Button>
|
||||||
<SimpleGrid
|
<SimpleGrid
|
||||||
spacing="md"
|
spacing="md"
|
||||||
cols={4}
|
cols={4}
|
||||||
|
@@ -19,7 +19,7 @@ func (s *Server) GetServerConfig(c *fiber.Ctx) error {
|
|||||||
func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
|
func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
|
||||||
form, err := c.MultipartForm()
|
form, err := c.MultipartForm()
|
||||||
if err != nil {
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,11 +77,16 @@ func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse all the other fields
|
// Parse all the other fields
|
||||||
|
description := ""
|
||||||
|
description = form.Value["Description"][0]
|
||||||
|
|
||||||
locNotes := ""
|
locNotes := ""
|
||||||
locNotes = form.Value["Notes"][0]
|
locNotes = form.Value["Notes"][0]
|
||||||
|
|
||||||
address := ""
|
address := ""
|
||||||
address = form.Value["Address"][0]
|
if val, ok := form.Value["Address"]; ok {
|
||||||
|
address = val[0]
|
||||||
|
}
|
||||||
|
|
||||||
squareFeet := ""
|
squareFeet := ""
|
||||||
squareFeet = form.Value["SquareFeet"][0]
|
squareFeet = form.Value["SquareFeet"][0]
|
||||||
@@ -97,13 +102,16 @@ func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
|
|||||||
longitude = form.Value["Latitude"][0]
|
longitude = form.Value["Latitude"][0]
|
||||||
|
|
||||||
datePurchased := ""
|
datePurchased := ""
|
||||||
datePurchased = form.Value["DatePurchased"][0]
|
if val, ok := form.Value["DatePurchased"]; ok {
|
||||||
|
datePurchased = val[0]
|
||||||
|
}
|
||||||
|
|
||||||
purchasePrice := ""
|
purchasePrice := ""
|
||||||
purchasePrice = form.Value["PurchasePrice"][0]
|
purchasePrice = form.Value["PurchasePrice"][0]
|
||||||
|
|
||||||
newLocation := Location{
|
newLocation := Location{
|
||||||
Name: locName,
|
Name: locName,
|
||||||
|
Description: description,
|
||||||
CoverPhoto: coverImageURL,
|
CoverPhoto: coverImageURL,
|
||||||
Address: address,
|
Address: address,
|
||||||
Latitude: latitude,
|
Latitude: latitude,
|
||||||
|
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/asdine/storm/v3"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,3 +21,63 @@ func (s *Server) SearchAllHandler(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
return c.Status(fiber.StatusOK).JSON(results)
|
return c.Status(fiber.StatusOK).JSON(results)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDatabaseOverview manually queries the DB to get some details about the database
|
||||||
|
func (s *Server) GetDatabaseOverview(c *fiber.Ctx) error {
|
||||||
|
|
||||||
|
locations := []Location{}
|
||||||
|
err := s.Database.AllByIndex("ID", &locations, storm.Reverse())
|
||||||
|
if err != nil {
|
||||||
|
s.Log.Error().Msgf("Failed to get last added location: %s ", err)
|
||||||
|
return c.Status(fiber.StatusInternalServerError).SendString(fmt.Sprintf("Database failure fetching last location! error: %s", err))
|
||||||
|
}
|
||||||
|
var lastAddedLocation *Location
|
||||||
|
if len(locations) > 0 {
|
||||||
|
lastAddedLocation = &locations[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
rooms := []Room{}
|
||||||
|
err = s.Database.AllByIndex("ID", &rooms, storm.Reverse())
|
||||||
|
if err != nil {
|
||||||
|
s.Log.Error().Msgf("Failed to get all rooms: %s ", err)
|
||||||
|
return c.Status(fiber.StatusInternalServerError).SendString(fmt.Sprintf("Database failure fetching all rooms! error: %s", err))
|
||||||
|
}
|
||||||
|
var lastAddedRoom *Room
|
||||||
|
if len(rooms) > 0 {
|
||||||
|
lastAddedRoom = &rooms[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
cabinets := []Cabinet{}
|
||||||
|
err = s.Database.AllByIndex("ID", &cabinets, storm.Reverse())
|
||||||
|
if err != nil {
|
||||||
|
s.Log.Error().Msgf("Failed to get all cabinets by ID: %s ", err)
|
||||||
|
return c.Status(fiber.StatusInternalServerError).SendString(fmt.Sprintf("Database failure fetching all cabinets! error: %s", err))
|
||||||
|
}
|
||||||
|
var lastAddedCabinet *Cabinet
|
||||||
|
if len(cabinets) > 0 {
|
||||||
|
lastAddedCabinet = &cabinets[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
items := []Item{}
|
||||||
|
err = s.Database.AllByIndex("ID", &items, storm.Reverse())
|
||||||
|
if err != nil {
|
||||||
|
s.Log.Error().Msgf("Failed to get all items by ID: %s ", err)
|
||||||
|
return c.Status(fiber.StatusInternalServerError).SendString(fmt.Sprintf("Database failure fetching all items! error: %s", err))
|
||||||
|
}
|
||||||
|
var lastAddedItem *Item
|
||||||
|
if len(items) > 0 {
|
||||||
|
lastAddedItem = &items[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
dbOverview := DatabaseOverview{
|
||||||
|
NumLocations: len(locations),
|
||||||
|
LastAddedLocation: lastAddedLocation,
|
||||||
|
NumRooms: len(rooms),
|
||||||
|
LastAddedRoom: lastAddedRoom,
|
||||||
|
NumCabinets: len(cabinets),
|
||||||
|
LastAddedCabinet: lastAddedCabinet,
|
||||||
|
NumItems: len(items),
|
||||||
|
LastAddedItem: lastAddedItem,
|
||||||
|
}
|
||||||
|
return c.Status(fiber.StatusOK).JSON(dbOverview)
|
||||||
|
}
|
||||||
|
@@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -51,72 +50,79 @@ func (s *Server) AddNewRoomHandler(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
form, err := c.MultipartForm()
|
form, err := c.MultipartForm()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.Log.Err(err).Msgf("Unable to fetch rooms: ", err)
|
s.Log.Err(err).Msgf("Unable to fetch new room form details: ", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// Both of these should be required on frontend, so not checking them because I'm lazy
|
||||||
|
// TODO: Check to make sure these exist
|
||||||
roomName := form.Value["Name"][0]
|
roomName := form.Value["Name"][0]
|
||||||
fmt.Println("COverphoto: ", form.File["CoverPhoto"])
|
|
||||||
roomPhoto := form.File["CoverPhoto"][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"]
|
|
||||||
// Fetch the location information
|
// Fetch the location information
|
||||||
loc, err := s.GetLocation(locID)
|
loc, err := s.GetLocation(locID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.Log.Err(err).Msgf("Unable to fetch location by id: %d with error: %s", locID, err)
|
s.Log.Err(err).Msgf("Unable to fetch location by id: %d with error: %s", locID, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// setting the path prepend for the photos
|
|
||||||
urlPrepend := loc.Name + "/" + roomName + "/"
|
|
||||||
pathPrepend := s.Config.Server.LocationFilesDir + "/" + urlPrepend
|
|
||||||
|
|
||||||
// Create the directory for this room to store the photos
|
// Create the directory for this room to store the photos
|
||||||
err = os.MkdirAll(filepath.ToSlash(s.Config.Server.LocationFilesDir+"/"+loc.Name+"/"+roomName), 0755)
|
err = os.MkdirAll(filepath.ToSlash(s.Config.Server.LocationFilesDir+"/"+loc.Name+"/"+roomName), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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(pathPrepend + roomName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename))
|
// setting the path prepend for the photos
|
||||||
photoURL := urlPrepend + roomName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename)
|
urlPrepend := loc.Name + "/" + roomName + "/"
|
||||||
photoURLsList = append(photoURLsList, photoURL)
|
pathPrepend := s.Config.Server.LocationFilesDir + "/" + urlPrepend
|
||||||
photoData, err := io.ReadAll(src)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
os.WriteFile(photoPath, photoData, 0644)
|
|
||||||
}
|
|
||||||
// create files on server for all uploads
|
|
||||||
roomNotes := form.Value["Notes"][0]
|
|
||||||
|
|
||||||
// saving the uploaded image to our images dir
|
// saving the uploaded image to our images dir
|
||||||
coverImagePath := filepath.ToSlash(pathPrepend + roomName + "_cover" + filepath.Ext(roomPhoto.Filename))
|
coverImagePath := filepath.ToSlash(pathPrepend + roomName + "_cover" + filepath.Ext(roomPhoto.Filename))
|
||||||
|
err = c.SaveFile(roomPhoto, coverImagePath)
|
||||||
|
if err != nil {
|
||||||
|
s.Log.Err(err).Msgf("Unable to write file: %s to path: %s, encountered err: %s", roomPhoto.Filename, coverImagePath, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
// Creating the URL to retrieve photo
|
// Creating the URL to retrieve photo
|
||||||
coverImageURL := urlPrepend + roomName + "_cover" + filepath.Ext(roomPhoto.Filename)
|
coverImageURL := urlPrepend + roomName + "_cover" + filepath.Ext(roomPhoto.Filename)
|
||||||
src, err := roomPhoto.Open()
|
|
||||||
|
var photoURLsList []string
|
||||||
|
if roomAdditionalPhotos := form.File["AdditionalPhotos"]; len(roomAdditionalPhotos) > 0 {
|
||||||
|
for i, photo := range roomAdditionalPhotos {
|
||||||
|
photoPath := filepath.ToSlash(pathPrepend + roomName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename))
|
||||||
|
photoURL := urlPrepend + roomName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename)
|
||||||
|
photoURLsList = append(photoURLsList, photoURL)
|
||||||
|
err = c.SaveFile(photo, photoPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
s.Log.Err(err).Msgf("Unable to write photo: %s to path: %s, encountered err: %s", photo.Filename, photoPath, err)
|
||||||
return err
|
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse all the other fields
|
||||||
|
roomNotes := ""
|
||||||
|
roomNotes = form.Value["Notes"][0]
|
||||||
|
|
||||||
|
description := ""
|
||||||
|
description = form.Value["Description"][0]
|
||||||
|
|
||||||
|
squareFeet := ""
|
||||||
|
squareFeet = form.Value["SquareFeet"][0]
|
||||||
|
|
||||||
|
squareFeetInt, err := strconv.ParseInt(squareFeet, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
s.Log.Err(err).Msgf("Unable to parse Square feet, input: %s error: %s", squareFeet, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
paint := ""
|
||||||
|
paint = form.Value["Paint"][0]
|
||||||
|
|
||||||
newRoom := Room{
|
newRoom := Room{
|
||||||
Name: roomName,
|
Name: roomName,
|
||||||
|
Description: description,
|
||||||
|
SquareFeet: int(squareFeetInt),
|
||||||
|
Paint: paint,
|
||||||
CoverPhoto: coverImageURL,
|
CoverPhoto: coverImageURL,
|
||||||
Photos: photoURLsList,
|
Photos: photoURLsList,
|
||||||
Notes: roomNotes,
|
Notes: roomNotes,
|
||||||
@@ -127,11 +133,7 @@ func (s *Server) AddNewRoomHandler(c *fiber.Ctx) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// // Update our location in the db to add the new room as attached to the ID
|
|
||||||
// loc, err = s.GetLocation(newRoom.LocationID)
|
|
||||||
// if err != nil {
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
roomList := loc.Rooms
|
roomList := loc.Rooms
|
||||||
roomList = append(roomList, newRoom)
|
roomList = append(roomList, newRoom)
|
||||||
|
|
||||||
|
1
main.go
1
main.go
@@ -121,6 +121,7 @@ func main() {
|
|||||||
server.WebServer.Delete("/api/items/:itemID", server.DeleteItemHandler)
|
server.WebServer.Delete("/api/items/:itemID", server.DeleteItemHandler)
|
||||||
// Misc Routes
|
// Misc Routes
|
||||||
server.WebServer.Get("/api/search/all", server.SearchAllHandler)
|
server.WebServer.Get("/api/search/all", server.SearchAllHandler)
|
||||||
|
server.WebServer.Get("/api/overview/all", server.GetDatabaseOverview)
|
||||||
|
|
||||||
// Start Server
|
// Start Server
|
||||||
fmt.Println("Everything ready, starting server! ", fmt.Sprintf(":%s", server.Config.Server.Port))
|
fmt.Println("Everything ready, starting server! ", fmt.Sprintf(":%s", server.Config.Server.Port))
|
||||||
|
Reference in New Issue
Block a user