mibfb-collab / message_in_a_bottle_backend Goto Github PK
View Code? Open in Web Editor NEWRepo to store back end infrastructure for Message in a Bottle
Repo to store back end infrastructure for Message in a Bottle
Need to add the following columns to table:
quickstart
app name will be problematic for our endpoints, based on how Django builds routes. This needs to be renamed to api
before we accrue any more technical debtStatic Files
directory that was auto-created floods the app with a bunch of additional JavaScript and CSS files that are not needed for the REST framework. We should remove these to slim down the infrastructure to what is actually needed for our purposes.dev
vs prod
during testingNote, this will be an ongoing exercise as we add additional endpoints.
Final Cleanup Checklist:
radius
back to 25
in MapService
module:
# services.py
def get_stories(lat, long, stories):
url = MapService.base_urls()['radius']
params = {
'key': MapService.api_key()
}
data = {
'origin': {
'latLng': {
'lat': float(lat),
'lng': float(long)
}
},
'options': {
'maxMatches': 100,
'radius': 50,
'units': 'm'
},
'remoteDataList': stories
}
response = requests.post(url, params=params, data=json.dumps(data, indent=1))
return response.json()
CORS_ALLOWED_ORIGINS
in settings.py
Return a dictionary of city/state as key with total stories as value, so users can search for stories by city/state
Placeholder issue to track any final test cleanup for Postman collection:
Dev
Prod
Endpoint to create new story in database
ENV VARS
ENV VAR
Refactor existing JSON responses to conform to JSON 1.0 Spec
Originally posted by @matt-kragen in #22 (comment)
/stories/<id:pk>
type
key and attributes
dict to nest individual table columns/stories
type
key and attributes
dict to nest individual table columnsSet up config.yml to enter virtual environment to run pytest on Circle CI
Passing in valid lat/lon can still result in an 'Impossible Route'. Need to error handle for this in view.
Endpoint to update a story within the database
Note: current placeholder is a PUT
request (from following original tutorial), which will require a couple refactors:
CORS_ALLOWED_METHODS
in settings.py
APIView
method call in views.py
to be a PATCH
(vs PUT
)Add and populate initial configuration files
Justin has pulled down main and is able to view all stories that have been added in the last few days, regardless of the mileage from his house. My main (which references the same endpoint) is no longer able to view any of these stories. I am able to post and view my own stories still, but do not have access to any Justin posts. Justin's main does not have access to any stories I post.
Request:
Response:
{"data":{"input_location":"This is a temporary location!","stories":[{"id":"91","type":"story","attributes":{"title":"This is a test","distance_in_miles":0,"latitude":40.337408,"longitude":-104.9460736}}]}}
The response is copy and pasted since the view screenshot on my dev tools cut half of it off. The response is only the story I posted while experimenting with this issue.
Endpoint to get directions to an individual Story.
GET /api/v1/test
with a very basic response for testing CORS
fetch
calls from FE are properly configured.Configure application to deploy passing builds via Travis CI || Circle CI
Half of the functions
in StorySerializer
pass self
, and half don't. As a team, we should comb back through in our final refactoring to ensure consistency one way or the other.
Note, pycodestyle
may help make the call on this for convention.. but based on my research, it's the most Pythonic way to always pass self
as the first arg to any function
See Python docs:
Often, the first argument of a method is called self. This is nothing more than a convention: the name self has absolutely no special meaning to Python. Note, however, that by not following the convention your code may be less readable to other Python programmers, and it is also conceivable that a class browser program might be written that relies upon such a convention.
Walk through architecture from the ground up
Looks like a VCR
equivalent exists.. need to investigate how this can integrate into our current test suite, to stub the remaining external API calls.
.env
ENV VAR
to CircleCI
CONFIG VAR
to Heroku
requests
package to requirements.txt
Best practice would be to stub these out, if we can.
Starting with test_services
module, and will refactor test_requests
module similarly, if enough time prior to code freeze.
Endpoint to delete a story
/api/v1/stories?latitude=&longitude=
message
to 1,000/api/v1/stories/<int:pk>
/api/v1/stories
/api/v1/stores/<int:pk>
Currently using Postman
to test our middleware, but we need to backfill request tests in pytest
, so we can run the full suite inclusive of model
and request
specs.
Might be able to leverage the built in APIRequestFactory module from DRF
Additional resource
Endpoint for all stories within database by input coordinates (user's lat/long from current location)
Endpoint to retrieve an individual story
Badges:
How to / Project Configs:
Rails
projects are removedBE Python Docs
thread from Slack)JSON contracts:
Database Schema:
See LucidChart for schema diagram
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.