fix(roles): Minor documentation + typings
This commit is contained in:
parent
2df5a61ff3
commit
1db3391826
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue