Open NabbeunNabi opened 4 months ago
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
Package | New capabilities | Transitives | Size | Publisher |
---|---|---|---|---|
npm/@types/googlemaps@3.43.3 | None | 0 |
232 kB | types |
This looks like a really good start! My only concern is about the cost. How can we prevent being charged from fake submissions, but still pre-fill the submission fields to satisfy the submission input? Let's discuss the pros and cons with doing this on the backend or frontend if we decide to implement a button for moderators to click to fetch the place data.
This looks like a really good start! My only concern is about the cost. How can we prevent being charged from fake submissions, but still pre-fill the submission fields to satisfy the submission input? Let's discuss the pros and cons with doing this on the backend or frontend if we decide to implement a button for moderators to click to fetch the place data.
Based on the discussions I have had with @ermish . As long as the Regex checks are working it will at least be a valid google maps url that is a location due to the redirection and the finding of the coordinates and making sure it is a google maps URL. And at this point it would be easiest to autofill on submission. If we get to the point where people start trying to submit fake URLS with bots we can implement a captcha library to prevent this.
This looks like a really good start! My only concern is about the cost. How can we prevent being charged from fake submissions, but still pre-fill the submission fields to satisfy the submission input? Let's discuss the pros and cons with doing this on the backend or frontend if we decide to implement a button for moderators to click to fetch the place data.
Based on the discussions I have had with @ermish . As long as the Regex checks are working it will at least be a valid google maps url that is a location due to the redirection and the finding of the coordinates and making sure it is a google maps URL. And at this point it would be easiest to autofill on submission. If we get to the point where people start trying to submit fake URLS with bots we can implement a captcha library to prevent this.
I actually refactored. I think overall it would be better as a button on the moderation panel. It does take some time. So we want the submission created as quickly as possible. The moderators can then autofill the database with the added mutation.
@NabbeunNabi bump in case you missed my review
@NabbeunNabi and I talked about this. Updated user flow:
We don't want to auto-run because not all submissions will need it plus it will prevent costs on spam submissions
@ermish I am going to get to this now. Due to our discussion. With it becoming a mutation where the button will exist in the future. Should I still refactor the locations. Or just fix the mutation name with some comments that help people understand the logic?
@ermish I am going to get to this now. Due to our discussion. With it becoming a mutation where the button will exist in the future. Should I still refactor the locations. Or just fix the mutation name with some comments that help people understand the logic?
if I understand, yes, it should still be moved into the service and an updated mutation
Resolves issue #234
The documentation that describes what I did is: -Google Places API documentation -Pricing Pricing is only $2.83 per 1000 calls
Flow
I made comments in the code to help follow. But this is the flow of the file:
regex
is used to extract the coordinates that are in every urlReasoning for flow
I tried multiple ways to get Tokyo Midtown Clinic will you will see is what I tested in the testing header. Following are the other things I tried and read about:
types
withhospital
in the argument array. But that seemed to prioritize hospitals only and clinics is not a viable argumentbody
that I wrote in the code included in thePOST
requestTesting Instructions (for now)
.env
with aGOOGLE_MAPS_API_KEY
tsx
installed run:OR
In the terminal run:
And then change the generated file from
.js
to.cjs
so the next command can run the common js generations and run:This was used to generate the following code twice for Tokyo Midtown Clinic using the google places API.
Try 1
Try 2
This is the frontend with the autofill data! It has the correct place. For each of these URLS