|
|
@ -46,6 +46,14 @@ def create_cookie(session: Session, json_data: http.RequestData, route: Router):
|
|
|
|
return http.Response(cookie.to_dict(), status=201, headers=headers)
|
|
|
|
return http.Response(cookie.to_dict(), status=201, headers=headers)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete_cookie(session: Session, id: int):
|
|
|
|
|
|
|
|
cookie = session.query(Cookie).filter_by(id=id).one_or_none()
|
|
|
|
|
|
|
|
if cookie is None:
|
|
|
|
|
|
|
|
msg = {"error": "404 Not Found"}
|
|
|
|
|
|
|
|
return http.Response(msg, status=404)
|
|
|
|
|
|
|
|
session.delete(cookie)
|
|
|
|
|
|
|
|
return {"message": "200 OK"}
|
|
|
|
|
|
|
|
|
|
|
|
routes = [
|
|
|
|
routes = [
|
|
|
|
Route('/state', 'GET', get_state),
|
|
|
|
Route('/state', 'GET', get_state),
|
|
|
|
Route('/cookies', 'GET', get_cookies),
|
|
|
|
Route('/cookies', 'GET', get_cookies),
|
|
|
@ -55,6 +63,8 @@ routes = [
|
|
|
|
Include('/static', static_urls)
|
|
|
|
Include('/static', static_urls)
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app_settings = {}
|
|
|
|
|
|
|
|
|
|
|
|
routes = routes + auth_routes
|
|
|
|
routes = routes + auth_routes
|
|
|
|
|
|
|
|
|
|
|
|
commands = sqlalchemy_backend.commands + commands
|
|
|
|
commands = sqlalchemy_backend.commands + commands
|
|
|
@ -64,7 +74,7 @@ components = sqlalchemy_backend.components + auth_components
|
|
|
|
|
|
|
|
|
|
|
|
def application_factory(settings={}):
|
|
|
|
def application_factory(settings={}):
|
|
|
|
"""Returns an instance of Cookie API"""
|
|
|
|
"""Returns an instance of Cookie API"""
|
|
|
|
return App(settings=settings,
|
|
|
|
return App(settings={**app_settings, **settings},
|
|
|
|
commands=commands,
|
|
|
|
commands=commands,
|
|
|
|
components=components,
|
|
|
|
components=components,
|
|
|
|
routes=routes)
|
|
|
|
routes=routes)
|
|
|
|