From 4628686d400497c560e457eee96e43da10065237 Mon Sep 17 00:00:00 2001 From: Koa Date: Tue, 17 Jan 2023 19:17:18 -0500 Subject: [PATCH] Update skeleton --- hub_api/city_commands.py | 60 ++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/hub_api/city_commands.py b/hub_api/city_commands.py index dbf3522..e190ec3 100644 --- a/hub_api/city_commands.py +++ b/hub_api/city_commands.py @@ -11,52 +11,88 @@ from imports.user_factory import UserFactory from exports.user_factory import UserFactory as ExUserFactory import os from hub_logger import logger +from hub_api.helpers.session_helper import refresh_session from hub_api.helpers.auth import generate_auth_token, role_required from persistence.models import UserRoles -#Admin commands - +#Admin user commands +""" +SaveCity class +""" class SaveCity(Resource): def __init__(self): print() @role_required([UserRoles.Admin.value]) def put(self): + session = refresh_session(request) + if session is None: + return Response(json.dumps({'error': 'invalid session'}), status=401) + headers = session.headers +""" +UpdateCity class +""" class UpdateCity(Resource): def __init__(self): print() @role_required([UserRoles.Admin.value]) def put(self): - - class UpdateCity(Resource): - + session = refresh_session(request) + if session is None: + return Response(json.dumps({'error': 'invalid session'}), status=401) + headers = session.headers +""" +DeleteCity class +""" class DeleteCity(Resource): def __init__(self): print() @role_required([UserRoles.Admin.value]) def delete(self): + session = refresh_session(request) + if session is None: + return Response(json.dumps({'error': 'invalid session'}), status=401) + headers = session.headers #Standard user commands - +""" +ListCities class +""" class ListCities(Resource): def __init__(self): print() @role_required([UserRoles.Admin.value]) def put(self): - + session = refresh_session(request) + if session is None: + return Response(json.dumps({'error': 'invalid session'}), status=401) + headers = session.headers +""" +SearchCity class +""" class SearchCity(Resource): def __init__(self): print() def get(self): + session = refresh_session(request) + if session is None: + return Response(json.dumps({'error': 'invalid session'}), status=401) + headers = session.headers +""" +UpdateCity class +""" +class UpdateCity(Resource): + def __init__(self): + print() - class UpdateCity(Resource): - def __init__(self): - print() - - def get(self): \ No newline at end of file + def get(self): + session = refresh_session(request) + if session is None: + return Response(json.dumps({'error': 'invalid session'}), status=401) + headers = session.headers \ No newline at end of file