Git Product home page Git Product logo

arrangethat-io-server's People

Contributors

deonjo avatar dependabot[bot] avatar jeffchiucp avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

arrangethat-io-server's Issues

login api route

This api should be "POST".
can we change it to methods=['POST']

@app.route("/login")
def login():
callback=url_for('authorized', _external=True)
return google.authorize(callback=callback)

POST request API for new arrangement

@app.route('/arrangement', methods=['POST'])
@app.route('/api/v1/arrangement', methods=['POST'])
def save_arrangement():
arrangement = request.json
json_data = validate_arrangement(arrangement)
if json_data == True:
arrangement_obj.pass_json(arrangement)
data = arrangement_obj.build()
arrangement_exists = mdb.check_arrangement_exists(data)
if arrangement_exists:
mdb.replace_arrangement(data)
else:
mdb.add_arrangement(data)
return JSONEncoder().encode(data)
else:
return jsonify({'message':'json is not validate'})

Second api is to create a new arrangement on backend side.
It will be the POST request from the backend

need to edit the backend code to update the user id

@app.route('/arrangement', methods=['GET'])
@app.route('/api/v1/arrangement', methods=['GET'])
@app.route('/arrangement/<string:arrangement_id>', methods=['GET'])
@app.route('/api/v1/arrangement/<string:arrangement_id>', methods=['GET'])
def get_arrangement(arrangement_id=None):
if arrangement_id is None:
return JSONEncoder().encode(mdb.get_all_arrangements())

need to add the following code to update the GET route
see the gist
@app.route('/arrangement', method=['GET'])
def arrangements():
"""
return all relevant arrangement belong to specific user
"""
user = get_current_user # define user using google api and return google_id as user
arrangements = get_arrangements(user) # define all arrangements that is associable with user_id belonged to google_id
return get_arrangement_titles_and_id(arrangements) # strip out the title and id of those arrangements

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.