Пример #1
0
def handlePlaceCreated():
    body = request.get_json()
    new_place = Place(
        name=body.get("name"),
        lng=body.get("long"),
        lat=body.get("lat"),
        description=body.get("description"),
    )

    session.add(new_place)
    session.flush()

    return jsonify({'id': new_place.id})
Пример #2
0
def handleUserCreated():
    body = request.get_json()
    new_user = User(
        name=body.get("name"),
        email=body.get("email"),
        birthdate=body.get("birthdate"),
        phone=body.get("phone"),
    )

    session.add(new_user)
    session.flush()

    return jsonify({'id': new_user.id})
Пример #3
0
def handleStoriesCreated():
    body = request.get_json()
    new_story = Story(place_id=body.get("place_id"),
                      user_id=body.get("user_id"),
                      availability=body.get("availability"),
                      num=body.get("num"),
                      price=body.get("price"),
                      validity=body.get("validity"))

    session.add(new_story)
    session.flush()

    return jsonify({'id': new_story.id})