diff --git a/flaschengeist/controller/roleController.py b/flaschengeist/controller/roleController.py index 204adad..86f74ab 100644 --- a/flaschengeist/controller/roleController.py +++ b/flaschengeist/controller/roleController.py @@ -1,9 +1,10 @@ +from typing import Union from sqlalchemy.exc import IntegrityError from werkzeug.exceptions import BadRequest, Conflict, NotFound +from flaschengeist import logger from flaschengeist.models.user import Role, Permission from flaschengeist.database import db, case_sensitive -from flaschengeist import logger from flaschengeist.utils.hook import Hook @@ -11,7 +12,15 @@ def get_all(): return Role.query.all() -def get(role_name) -> Role: +def get(role_name: Union[int,str]) -> Role: + """Get role by ID or name + Args: + role_name: Name or ID of the role + Returns: + Matching role + Raises: + NotFound + """ if type(role_name) is int: role = Role.query.get(role_name) else: