working on sending the new location form data, and getting it from the backend

This commit is contained in:
2022-04-08 22:51:19 -04:00
parent 5a71db469a
commit 25deaf43c8
24 changed files with 170 additions and 68 deletions

View File

@@ -1,7 +1,7 @@
# All values in this config file WILL BE overwritten by ENV variables (GI_SERVER_PORT for example) if they exist.
Server:
port: 3500
locationPhotoDir: "./app/photos/locations/"
locationFilesDir: "./app/files/locations/"
Logger:
loglevel: "debug" # debug/info/warn/error

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 282 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 349 KiB

After

Width:  |  Height:  |  Size: 349 KiB

View File

Before

Width:  |  Height:  |  Size: 536 KiB

After

Width:  |  Height:  |  Size: 536 KiB

View File

Before

Width:  |  Height:  |  Size: 536 KiB

After

Width:  |  Height:  |  Size: 536 KiB

View File

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 282 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 349 KiB

After

Width:  |  Height:  |  Size: 349 KiB

View File

Before

Width:  |  Height:  |  Size: 536 KiB

After

Width:  |  Height:  |  Size: 536 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 349 KiB

After

Width:  |  Height:  |  Size: 349 KiB

View File

Before

Width:  |  Height:  |  Size: 536 KiB

After

Width:  |  Height:  |  Size: 536 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

View File

@@ -5,10 +5,10 @@
{"level":"error","time":"2022-04-02T22:20:17-04:00","message":"SearchAllByField failed to return results: not found "}
{"logtype":"webserver", "pid":"19312", "requestid":"", "status":"200", "method":"GET", "path":"/api/search/all"}
{"level":"info","time":"2022-04-02T22:21:18-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-02T22:21:18-04: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":"debug","time":"2022-04-02T22:21:18-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-02T22:21:18-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-02T22:22:54-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-02T22:22:54-04: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":"debug","time":"2022-04-02T22:22:54-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-02T22:22:54-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"debug","time":"2022-04-02T22:23:04-04:00","message":"Seach by term: Location in all items at field: Name"}
{"level":"info","time":"2022-04-02T22:23:04-04:00","message":"Searching all items for term: Location"}
@@ -17,25 +17,25 @@
{"level":"info","time":"2022-04-02T22:23:09-04:00","message":"Searching all items for term: Location4"}
{"logtype":"webserver", "pid":"7620", "requestid":"", "status":"200", "method":"GET", "path":"/api/search/all"}
{"level":"info","time":"2022-04-02T22:29:23-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-02T22:29:23-04: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":"debug","time":"2022-04-02T22:29:23-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-02T22:29:23-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-02T22:29:31-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-02T22:29:31-04: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":"debug","time":"2022-04-02T22:29:31-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-02T22:29:31-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"debug","time":"2022-04-02T22:29:37-04:00","message":"Seach by term: Location4 in all items at field: Name"}
{"level":"info","time":"2022-04-02T22:29:37-04:00","message":"Searching all items for term: Location4"}
{"logtype":"webserver", "pid":"15332", "requestid":"", "status":"200", "method":"GET", "path":"/api/search/all"}
{"level":"info","time":"2022-04-02T22:30:28-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-02T22:30:28-04: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":"debug","time":"2022-04-02T22:30:28-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-02T22:30:28-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-02T22:30:34-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-02T22:30:34-04: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":"debug","time":"2022-04-02T22:30:34-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-02T22:30:34-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"debug","time":"2022-04-02T22:30:36-04:00","message":"Seach by term: Location4 in all items at field: Name"}
{"level":"info","time":"2022-04-02T22:30:36-04:00","message":"Searching all items for term: Location4"}
{"logtype":"webserver", "pid":"30864", "requestid":"", "status":"200", "method":"GET", "path":"/api/search/all"}
{"level":"info","time":"2022-04-02T22:31:16-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-02T22:31:16-04: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":"debug","time":"2022-04-02T22:31:16-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-02T22:31:16-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"debug","time":"2022-04-02T22:31:22-04:00","message":"Seach by term: Location4 in all items at field: Name"}
{"level":"info","time":"2022-04-02T22:31:22-04:00","message":"Searching all items for term: Location4"}
@@ -44,10 +44,10 @@
{"level":"info","time":"2022-04-02T22:32:41-04:00","message":"Searching all items for term: Kitchen"}
{"logtype":"webserver", "pid":"8468", "requestid":"", "status":"200", "method":"GET", "path":"/api/search/all"}
{"level":"info","time":"2022-04-02T22:33:39-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-02T22:33:39-04: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":"debug","time":"2022-04-02T22:33:39-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-02T22:33:39-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-02T22:38:47-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-02T22:38:47-04: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":"debug","time":"2022-04-02T22:38:47-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-02T22:38:47-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-02T22:39:03-04:00","message":"Fetching room with id: 1"}
{"logtype":"webserver", "pid":"11448", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/1"}
@@ -79,7 +79,7 @@
{"level":"debug","time":"2022-04-02T23:14:39-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Paint: Notes:Notes For My Room! Cabinets:[] Items:[] SquareFeet:0 LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue:} {ID:2 Name:Location6 Description: CoverPhoto:Location6_cover.png Photos:[Location6_0.png Location6_1.png] Rooms:[] Notes:Notes for my location!6 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue:} {ID:3 Name:Location10 Description: CoverPhoto:Location10_cover.png Photos:[] Rooms:[] Notes:Notes for my location!10 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue:}]"}
{"logtype":"webserver", "pid":"11448", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-04-03T16:13:11-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-03T16:13:11-04: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":"debug","time":"2022-04-03T16:13:11-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-03T16:13:11-04:00","message":"Database and Config loaded, starting webserver..."}
{"logtype":"webserver", "pid":"8168", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"8168", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
@@ -96,19 +96,72 @@
{"logtype":"webserver", "pid":"8168", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"8168", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-04-03T20:46:19-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-03T20:46:19-04: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":"debug","time":"2022-04-03T20:46:19-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-03T20:46:19-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-03T20:46:20-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-03T20:46:20-04: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":"debug","time":"2022-04-03T20:46:20-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-03T20:46:20-04:00","message":"Database and Config loaded, starting webserver..."}
{"logtype":"webserver", "pid":"16808", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-04-03T20:52:11-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-03T20:52:11-04: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":"debug","time":"2022-04-03T20:52:11-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-03T20:52:11-04:00","message":"Database and Config loaded, starting webserver..."}
{"logtype":"webserver", "pid":"19608", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"19608", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-04-03T21:44:35-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-03T21:44:35-04: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":"debug","time":"2022-04-03T21:44:35-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-03T21:44:35-04:00","message":"Database and Config loaded, starting webserver..."}
{"logtype":"webserver", "pid":"1812", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"1812", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-04-07T16:25:58-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-07T16:25:58-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-07T16:25:58-04:00","message":"Database and Config loaded, starting webserver..."}
{"logtype":"webserver", "pid":"23364", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"23364", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"info","time":"2022-04-08T21:57:11-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-08T21:57:11-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-08T21:57:11-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-08T22:10:01-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-08T22:10:01-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-08T22:10:01-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-08T22:19:45-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-08T22:19:45-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-08T22:19:45-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-08T22:22:18-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-08T22:22:18-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-08T22:22:18-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-08T22:22:24-04:00","message":"Adding new location to database: %!(EXTRA main.Location={0 TESTasdfsdaf test 0 TESTasdfsdaf_cover.png [] [] []})"}
{"level":"debug","time":"2022-04-08T22:22:24-04:00","message":"Adding new location: {0 TESTasdfsdaf test 0 TESTasdfsdaf_cover.png [] [] []}"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"POST", "path":"/api/locations/new"}
{"level":"debug","time":"2022-04-08T22:22:34-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: Notes:Notes for my location! Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Files:[] Rooms:[{ID:0 Name:Kitchen Description: Paint: Notes:Notes For My Room! SquareFeet:0 CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Cabinets:[] Items:[] LocationID:1 LocationName:Location4}]} {ID:2 Name:Location6 Description: Notes:Notes for my location!6 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location6_cover.png Photos:[Location6_0.png Location6_1.png] Files:[] Rooms:[]} {ID:3 Name:Location10 Description: Notes:Notes for my location!10 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location10_cover.png Photos:[] Files:[] Rooms:[]} {ID:4 Name:TESTasdfsdaf Description: Notes:test Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:TESTasdfsdaf_cover.png Photos:[] Files:[] Rooms:[]}]"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-04-08T22:22:52-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: Notes:Notes for my location! Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Files:[] Rooms:[{ID:0 Name:Kitchen Description: Paint: Notes:Notes For My Room! SquareFeet:0 CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Cabinets:[] Items:[] LocationID:1 LocationName:Location4}]} {ID:2 Name:Location6 Description: Notes:Notes for my location!6 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location6_cover.png Photos:[Location6_0.png Location6_1.png] Files:[] Rooms:[]} {ID:3 Name:Location10 Description: Notes:Notes for my location!10 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location10_cover.png Photos:[] Files:[] Rooms:[]} {ID:4 Name:TESTasdfsdaf Description: Notes:test Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:TESTasdfsdaf_cover.png Photos:[] Files:[] Rooms:[]}]"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/photos/locations/TESTasdfsdaf/TESTasdfsdaf_cover.png"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/photos/locations/Location4/Location4_cover.png"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/photos/locations/Location10/Location10_cover.png"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/photos/locations/Location6/Location6_cover.png"}
{"level":"debug","time":"2022-04-08T22:26:15-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: Notes:Notes for my location! Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Files:[] Rooms:[{ID:0 Name:Kitchen Description: Paint: Notes:Notes For My Room! SquareFeet:0 CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Cabinets:[] Items:[] LocationID:1 LocationName:Location4}]} {ID:2 Name:Location6 Description: Notes:Notes for my location!6 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location6_cover.png Photos:[Location6_0.png Location6_1.png] Files:[] Rooms:[]} {ID:3 Name:Location10 Description: Notes:Notes for my location!10 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location10_cover.png Photos:[] Files:[] Rooms:[]} {ID:4 Name:TESTasdfsdaf Description: Notes:test Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:TESTasdfsdaf_cover.png Photos:[] Files:[] Rooms:[]}]"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/TESTasdfsdaf/TESTasdfsdaf_cover.png"}
{"level":"debug","time":"2022-04-08T22:26:18-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: Notes:Notes for my location! Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Files:[] Rooms:[{ID:0 Name:Kitchen Description: Paint: Notes:Notes For My Room! SquareFeet:0 CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Cabinets:[] Items:[] LocationID:1 LocationName:Location4}]} {ID:2 Name:Location6 Description: Notes:Notes for my location!6 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location6_cover.png Photos:[Location6_0.png Location6_1.png] Files:[] Rooms:[]} {ID:3 Name:Location10 Description: Notes:Notes for my location!10 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location10_cover.png Photos:[] Files:[] Rooms:[]} {ID:4 Name:TESTasdfsdaf Description: Notes:test Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:TESTasdfsdaf_cover.png Photos:[] Files:[] Rooms:[]}]"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-04-08T22:27:01-04:00","message":"Adding new location to database: %!(EXTRA main.Location={0 Final Test 0 Final Test_cover.png [] [] []})"}
{"level":"debug","time":"2022-04-08T22:27:01-04:00","message":"Adding new location: {0 Final Test 0 Final Test_cover.png [] [] []}"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"POST", "path":"/api/locations/new"}
{"level":"debug","time":"2022-04-08T22:27:11-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: Notes:Notes for my location! Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Files:[] Rooms:[{ID:0 Name:Kitchen Description: Paint: Notes:Notes For My Room! SquareFeet:0 CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Cabinets:[] Items:[] LocationID:1 LocationName:Location4}]} {ID:2 Name:Location6 Description: Notes:Notes for my location!6 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location6_cover.png Photos:[Location6_0.png Location6_1.png] Files:[] Rooms:[]} {ID:3 Name:Location10 Description: Notes:Notes for my location!10 Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Location10_cover.png Photos:[] Files:[] Rooms:[]} {ID:4 Name:TESTasdfsdaf Description: Notes:test Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:TESTasdfsdaf_cover.png Photos:[] Files:[] Rooms:[]} {ID:5 Name:Final Test Description: Notes: Address: SquareFeet:0 Latitude: Longitude: DatePurchased: PurchasePrice: CurrentValue: CoverPhoto:Final Test_cover.png Photos:[] Files:[] Rooms:[]}]"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"200", "method":"GET", "path":"/photos/locations/Final%20Test/Final%20Test_cover.png"}
{"logtype":"webserver", "pid":"11084", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/TESTasdfsdaf/TESTasdfsdaf_cover.png"}
{"level":"info","time":"2022-04-08T22:41:02-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-08T22:41:02-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationFilesDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-04-08T22:41:02-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-08T22:49:49-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-08T22:49: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-08T22:49:49-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-04-08T22:49:55-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-04-08T22:49:55-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:49:55-04:00","message":"Database and Config loaded, starting webserver..."}
{"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":"info","time":"2022-04-08T22:50:26-04:00","message":"Database and Config loaded, starting webserver..."}

View File

@@ -12,7 +12,7 @@ import (
var defaultConfig = `# All values in this config file WILL BE overwritten by ENV variables (GI_SERVER_PORT for example) if they exist.
Server:
port: 3500
locationPhotoDir: "./app/photos/locations/"
LocationFilesDir: "./app/photos/locations/"
Logger:
loglevel: "debug" # debug/info/warn/error
@@ -31,7 +31,7 @@ type Config struct {
Timezone string `fig:"tz" default:"America/New_York"`
Server struct {
Port string `fig:"port" default:"3000"`
LocationPhotoDir string `fig:"locationPhotoDir" default:"./app/photos/locations/"`
LocationFilesDir string `fig:"LocationFilesDir" default:"./app/photos/locations/"`
}
Logger struct {
Level string `fig:"loglevel" default:"info"`
@@ -101,7 +101,7 @@ func LoadConfig(s *Server) error {
}
s.Log = zerolog.New(logFile).With().Timestamp().Logger()
// Creating photo directory
err = os.MkdirAll(cfg.Server.LocationPhotoDir, 0755)
err = os.MkdirAll(cfg.Server.LocationFilesDir, 0755)
if err != nil {
return err
}

View File

@@ -23,7 +23,7 @@ function LocationForm(props) {
Description: '',
Notes: '',
Address: '',
SquareFeet: 0,
SquareFeet: '',
Latitude: '',
Longitude: '',
DatePurchased: '',
@@ -34,7 +34,7 @@ function LocationForm(props) {
},
validate: {
Name: (value) => (/^\S+/.test(value) ? null : 'Invalid Name')
},
});
@@ -45,8 +45,19 @@ function LocationForm(props) {
const submitNewLocation = (values) => {
console.log("VALUES: ", values)
const formData = new FormData(values)
// let additionalPhotos = values.AdditionalPhotos
let formData = new FormData()
for (const [key, value] of Object.entries(values)) {
if (key === "AdditionalPhotos" && value.length > 0) {
value.forEach(photo => {
console.log("PHOTO VALUE: ", photo)
formData.append(key, photo)
});
}
formData.append(key, value)
}
backendAPI.post("/locations/new", formData).then((result) => {
console.log("STATUS: ", result.status)
console.log("result: ", result.data)
}).catch(err => {
console.log("Error adding new location!", err)
@@ -108,7 +119,7 @@ function LocationForm(props) {
<TextInput label="Date Purchased" value={form.values.DatePurchased} {...form.getInputProps('DatePurchased')} />
<TextInput label="Purchase Price" value={form.values.PurchasePrice} {...form.getInputProps('PurchasePrice')}/>
<TextInput label="Current Value" value={form.values.CurrentValue} {...form.getInputProps('CurrentValue')}/>
<Title order={4}>Location Cover Photo</Title>
<Group><Title order={4}>Location Cover Photo </Title><Text color="red">*</Text></Group>
<Dropzone
onDrop={(files) => form.setFieldValue('CoverPhoto', files[0])}
onReject={(files) => console.log('rejected files', files)}
@@ -126,10 +137,12 @@ function LocationForm(props) {
multiple={true}
accept={PDF_MIME_TYPE}
getInputProps={{"capture": "environment"}}
>
{(status) => dropzoneChildren(status, theme, true)}
</Dropzone>
<Button type="submit">Submit</Button>
</Grid.Col>
</Grid>

View File

@@ -74,7 +74,7 @@ func (s *Server) AddNewCabinetHandler(c *fiber.Ctx) error {
}
// setting the path prepend for the photos
urlPrepend := loc.Name + "/" + room.Name + "/" + cabinetName + "/"
pathPrepend := s.Config.Server.LocationPhotoDir + "/" + urlPrepend
pathPrepend := s.Config.Server.LocationFilesDir + "/" + urlPrepend
// Create the directory for this cabinet to store the photos
err = os.MkdirAll(filepath.ToSlash(pathPrepend), 0755)

View File

@@ -124,7 +124,7 @@ func (s *Server) AddNewItemHandler(c *fiber.Ctx) error {
} else {
urlPrepend = loc.Name + "/" + room.Name + "/" + cabinet.Name + "/" + itemName
}
pathPrepend := s.Config.Server.LocationPhotoDir + "/" + urlPrepend + "/"
pathPrepend := s.Config.Server.LocationFilesDir + "/" + urlPrepend + "/"
// Create the directory for this item to store the photos
err = os.MkdirAll(filepath.ToSlash(pathPrepend), 0755)

View File

@@ -2,7 +2,6 @@ package main
import (
"fmt"
"io"
"os"
"path/filepath"
"strconv"
@@ -23,60 +22,97 @@ func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
s.Log.Err(err).Msgf("Unable to fetch locations: ", 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
locName := form.Value["Name"][0]
locPhoto := form.File["CoverPhoto"][0]
if err != nil {
s.Log.Err(err).Msgf("Unable to get CoverPhoto for location: ", err)
return err
}
locAdditionalPhotos := form.File["AdditionalPhotos"]
// Create the directory for this location to store the photos
err = os.MkdirAll(s.Config.Server.LocationPhotoDir+locName, 0755)
err = os.MkdirAll(s.Config.Server.LocationFilesDir+locName, 0755)
if err != nil {
s.Log.Err(err).Msgf("Unable to create photos dir path: Attempted path: %s error: %s", s.Config.Server.LocationFilesDir+locName, err)
return err
}
var photoURLsList []string
for i, photo := range locAdditionalPhotos {
src, err := photo.Open()
if err != nil {
return err
}
defer src.Close()
photoPath := filepath.ToSlash(s.Config.Server.LocationPhotoDir + locName + "/" + locName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename))
photoURL := locName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename)
photoURLsList = append(photoURLsList, photoURL)
photoData, err := io.ReadAll(src)
// saving the uploaded cover image to our images dir
coverImagePath := filepath.ToSlash(s.Config.Server.LocationFilesDir + locName + "/" + locName + "_cover" + filepath.Ext(locPhoto.Filename))
err = c.SaveFile(locPhoto, coverImagePath)
if err != nil {
s.Log.Err(err).Msgf("Unable to write file: %s to path: %s, encountered err: %s", locPhoto.Filename, coverImagePath, err)
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 + locName + "/" + locName + "_cover" + filepath.Ext(locPhoto.Filename))
// Creating the URL to retrieve photo
coverImageURL := locName + "_cover" + filepath.Ext(locPhoto.Filename)
src, err := locPhoto.Open()
// Creating the empty list to store all of our additional photo URLS
var photoURLsList []string
// If we have additional files, handle those
if locAdditionalPhotos := form.File["AdditionalPhotos"]; len(locAdditionalPhotos) > 0 {
fmt.Println("Additional Photos: ", locAdditionalPhotos)
for i, photo := range locAdditionalPhotos {
photoPath := filepath.ToSlash(s.Config.Server.LocationFilesDir + locName + "/" + locName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename))
photoURL := locName + "_" + strconv.Itoa(i) + filepath.Ext(photo.Filename)
photoURLsList = append(photoURLsList, photoURL)
err = c.SaveFile(photo, photoPath)
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
}
defer src.Close()
coverImageData, err := io.ReadAll(src)
}
}
var fileURLsList []string
if additionalFiles := form.File["Files"]; len(additionalFiles) > 0 {
for i, file := range additionalFiles {
filePath := filepath.ToSlash(s.Config.Server.LocationFilesDir + locName + "/" + locName + "_" + strconv.Itoa(i) + filepath.Ext(file.Filename))
fileUrl := locName + "_" + strconv.Itoa(i) + filepath.Ext(file.Filename)
fileURLsList = append(fileURLsList, fileUrl)
err = c.SaveFile(file, filePath)
if err != nil {
s.Log.Err(err).Msgf("Unable to read cover photo file: ", err)
s.Log.Err(err).Msgf("Unable to write file: %s to path: %s, encountered err: %s", file.Filename, filePath, err)
return err
}
err = os.WriteFile(coverImagePath, coverImageData, 0644)
if err != nil {
return err
}
}
// Parse all the other fields
locNotes := ""
locNotes = form.Value["Notes"][0]
address := ""
address = form.Value["Address"][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)
}
latitude := ""
latitude = form.Value["Latitude"][0]
longitude := ""
longitude = form.Value["Latitude"][0]
datePurchased := ""
datePurchased = form.Value["DatePurchased"][0]
purchasePrice := ""
purchasePrice = form.Value["PurchasePrice"][0]
newLocation := Location{
Name: locName,
CoverPhoto: coverImageURL,
Address: address,
Latitude: latitude,
Longitude: longitude,
DatePurchased: datePurchased,
PurchasePrice: purchasePrice,
SquareFeet: int(squareFeetInt),
Photos: photoURLsList,
Files: fileURLsList,
Notes: locNotes,
}
err = s.AddLocation(newLocation)

View File

@@ -70,10 +70,10 @@ func (s *Server) AddNewRoomHandler(c *fiber.Ctx) error {
}
// setting the path prepend for the photos
urlPrepend := loc.Name + "/" + roomName + "/"
pathPrepend := s.Config.Server.LocationPhotoDir + "/" + urlPrepend
pathPrepend := s.Config.Server.LocationFilesDir + "/" + urlPrepend
// Create the directory for this room to store the photos
err = os.MkdirAll(filepath.ToSlash(s.Config.Server.LocationPhotoDir+"/"+loc.Name+"/"+roomName), 0755)
err = os.MkdirAll(filepath.ToSlash(s.Config.Server.LocationFilesDir+"/"+loc.Name+"/"+roomName), 0755)
if err != nil {
return err
}