diff --git a/app/config/config.yaml b/app/config/config.yaml index c4b99b0..cf51ace 100644 --- a/app/config/config.yaml +++ b/app/config/config.yaml @@ -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 diff --git a/app/files/locations/Final Test/Final Test_cover.png b/app/files/locations/Final Test/Final Test_cover.png new file mode 100644 index 0000000..f2c863e Binary files /dev/null and b/app/files/locations/Final Test/Final Test_cover.png differ diff --git a/app/photos/locations/Location1/Kitchen/Kitchen_0.png b/app/files/locations/Location1/Kitchen/Kitchen_0.png similarity index 100% rename from app/photos/locations/Location1/Kitchen/Kitchen_0.png rename to app/files/locations/Location1/Kitchen/Kitchen_0.png diff --git a/app/photos/locations/Location1/Kitchen/Kitchen_cover.png b/app/files/locations/Location1/Kitchen/Kitchen_cover.png similarity index 100% rename from app/photos/locations/Location1/Kitchen/Kitchen_cover.png rename to app/files/locations/Location1/Kitchen/Kitchen_cover.png diff --git a/app/photos/locations/Location1/Location1_0.png b/app/files/locations/Location1/Location1_0.png similarity index 100% rename from app/photos/locations/Location1/Location1_0.png rename to app/files/locations/Location1/Location1_0.png diff --git a/app/photos/locations/Location1/Location1_1.png b/app/files/locations/Location1/Location1_1.png similarity index 100% rename from app/photos/locations/Location1/Location1_1.png rename to app/files/locations/Location1/Location1_1.png diff --git a/app/photos/locations/Location1/Location1_cover.png b/app/files/locations/Location1/Location1_cover.png similarity index 100% rename from app/photos/locations/Location1/Location1_cover.png rename to app/files/locations/Location1/Location1_cover.png diff --git a/app/photos/locations/Location10/Location10_cover.png b/app/files/locations/Location10/Location10_cover.png similarity index 100% rename from app/photos/locations/Location10/Location10_cover.png rename to app/files/locations/Location10/Location10_cover.png diff --git a/app/photos/locations/Location4/Kitchen/Kitchen_0.png b/app/files/locations/Location4/Kitchen/Kitchen_0.png similarity index 100% rename from app/photos/locations/Location4/Kitchen/Kitchen_0.png rename to app/files/locations/Location4/Kitchen/Kitchen_0.png diff --git a/app/photos/locations/Location4/Kitchen/Kitchen_cover.png b/app/files/locations/Location4/Kitchen/Kitchen_cover.png similarity index 100% rename from app/photos/locations/Location4/Kitchen/Kitchen_cover.png rename to app/files/locations/Location4/Kitchen/Kitchen_cover.png diff --git a/app/photos/locations/Location4/Location4_0.png b/app/files/locations/Location4/Location4_0.png similarity index 100% rename from app/photos/locations/Location4/Location4_0.png rename to app/files/locations/Location4/Location4_0.png diff --git a/app/photos/locations/Location4/Location4_1.png b/app/files/locations/Location4/Location4_1.png similarity index 100% rename from app/photos/locations/Location4/Location4_1.png rename to app/files/locations/Location4/Location4_1.png diff --git a/app/photos/locations/Location4/Location4_cover.png b/app/files/locations/Location4/Location4_cover.png similarity index 100% rename from app/photos/locations/Location4/Location4_cover.png rename to app/files/locations/Location4/Location4_cover.png diff --git a/app/photos/locations/Location6/Location6_0.png b/app/files/locations/Location6/Location6_0.png similarity index 100% rename from app/photos/locations/Location6/Location6_0.png rename to app/files/locations/Location6/Location6_0.png diff --git a/app/photos/locations/Location6/Location6_1.png b/app/files/locations/Location6/Location6_1.png similarity index 100% rename from app/photos/locations/Location6/Location6_1.png rename to app/files/locations/Location6/Location6_1.png diff --git a/app/photos/locations/Location6/Location6_cover.png b/app/files/locations/Location6/Location6_cover.png similarity index 100% rename from app/photos/locations/Location6/Location6_cover.png rename to app/files/locations/Location6/Location6_cover.png diff --git a/app/files/locations/TESTasdfsdaf/TESTasdfsdaf_cover.png b/app/files/locations/TESTasdfsdaf/TESTasdfsdaf_cover.png new file mode 100644 index 0000000..dc581ea Binary files /dev/null and b/app/files/locations/TESTasdfsdaf/TESTasdfsdaf_cover.png differ diff --git a/app/log/goInventorize.log b/app/log/goInventorize.log index b7bb475..4f7a7f6 100644 --- a/app/log/goInventorize.log +++ b/app/log/goInventorize.log @@ -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..."} diff --git a/config.go b/config.go index ae1bb90..c700257 100644 --- a/config.go +++ b/config.go @@ -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 } diff --git a/frontend/src/components/forms/LocationForm.js b/frontend/src/components/forms/LocationForm.js index eb1bc9f..d351af9 100644 --- a/frontend/src/components/forms/LocationForm.js +++ b/frontend/src/components/forms/LocationForm.js @@ -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) { - Location Cover Photo + Location Cover Photo * 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)} - + diff --git a/handlers_cabinet.go b/handlers_cabinet.go index b19b2ad..34d240f 100644 --- a/handlers_cabinet.go +++ b/handlers_cabinet.go @@ -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) diff --git a/handlers_item.go b/handlers_item.go index 8fe6aaf..8db30b3 100644 --- a/handlers_item.go +++ b/handlers_item.go @@ -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) diff --git a/handlers_location.go b/handlers_location.go index fa2b9df..f15472e 100644 --- a/handlers_location.go +++ b/handlers_location.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "io" "os" "path/filepath" "strconv" @@ -23,61 +22,98 @@ 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) - if err != nil { - return err - } - os.WriteFile(photoPath, photoData, 0644) + // 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 } - // 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() - if err != nil { - return err + + // 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) - if err != nil { - s.Log.Err(err).Msgf("Unable to read cover photo file: ", err) - return err + + 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 write file: %s to path: %s, encountered err: %s", file.Filename, filePath, err) + return err + } + } } - err = os.WriteFile(coverImagePath, coverImageData, 0644) + + // 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 { - return err + 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, - Photos: photoURLsList, - Notes: locNotes, + 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) if err != nil { diff --git a/handlers_room.go b/handlers_room.go index d0671ff..45bff14 100644 --- a/handlers_room.go +++ b/handlers_room.go @@ -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 }