Update skeleton

This commit is contained in:
Koa 2023-01-17 19:17:18 -05:00
parent a9e740d034
commit 4628686d40

View File

@ -11,52 +11,88 @@ from imports.user_factory import UserFactory
from exports.user_factory import UserFactory as ExUserFactory from exports.user_factory import UserFactory as ExUserFactory
import os import os
from hub_logger import logger 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 hub_api.helpers.auth import generate_auth_token, role_required
from persistence.models import UserRoles from persistence.models import UserRoles
#Admin commands #Admin user commands
"""
SaveCity class
"""
class SaveCity(Resource): class SaveCity(Resource):
def __init__(self): def __init__(self):
print() print()
@role_required([UserRoles.Admin.value]) @role_required([UserRoles.Admin.value])
def put(self): 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): class UpdateCity(Resource):
def __init__(self): def __init__(self):
print() print()
@role_required([UserRoles.Admin.value]) @role_required([UserRoles.Admin.value])
def put(self): def put(self):
session = refresh_session(request)
class UpdateCity(Resource): if session is None:
return Response(json.dumps({'error': 'invalid session'}), status=401)
headers = session.headers
"""
DeleteCity class
"""
class DeleteCity(Resource): class DeleteCity(Resource):
def __init__(self): def __init__(self):
print() print()
@role_required([UserRoles.Admin.value]) @role_required([UserRoles.Admin.value])
def delete(self): 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 #Standard user commands
"""
ListCities class
"""
class ListCities(Resource): class ListCities(Resource):
def __init__(self): def __init__(self):
print() print()
@role_required([UserRoles.Admin.value]) @role_required([UserRoles.Admin.value])
def put(self): 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): class SearchCity(Resource):
def __init__(self): def __init__(self):
print() print()
def get(self): 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 get(self):
def __init__(self): session = refresh_session(request)
print() if session is None:
return Response(json.dumps({'error': 'invalid session'}), status=401)
def get(self): headers = session.headers