Fix: Case Type Permission Error

This commit is contained in:
Amritanshu Agrawal 2021-01-13 11:53:45 +05:30
parent 6e37690736
commit 8845ee6a81

View File

@ -30,7 +30,7 @@ def get_db():
def save(
data: schemas.CaseTypeIn,
db: Session = Depends(get_db),
user: UserToken = Security(get_user, scopes=["case_types"]),
user: UserToken = Security(get_user, scopes=["case-types"]),
) -> schemas.CaseType:
try:
item = CaseType(name=data.name)
@ -53,7 +53,7 @@ def update(
id_: uuid.UUID,
data: schemas.CaseTypeIn,
db: Session = Depends(get_db),
user: UserToken = Security(get_user, scopes=["case_types"]),
user: UserToken = Security(get_user, scopes=["case-types"]),
) -> schemas.CaseType:
try:
item: CaseType = db.query(CaseType).filter(CaseType.id == id_).first()
@ -75,7 +75,7 @@ def update(
def delete(
id_: uuid.UUID,
db: Session = Depends(get_db),
user: UserToken = Security(get_user, scopes=["case_types"]),
user: UserToken = Security(get_user, scopes=["case-types"]),
) -> schemas.CaseTypeBlank:
try:
item: CaseType = db.query(CaseType).filter(CaseType.id == id_).first()
@ -96,7 +96,7 @@ def delete(
@router.get("", response_model=schemas.CaseTypeBlank)
def show_blank(
db: Session = Depends(get_db),
user: UserToken = Security(get_user, scopes=["case_types"]),
user: UserToken = Security(get_user, scopes=["case-types"]),
) -> schemas.CaseTypeBlank:
return case_type_blank()
@ -110,7 +110,7 @@ def show_list(db: Session = Depends(get_db), user: UserToken = Depends(get_user)
def show_id(
id_: uuid.UUID,
db: Session = Depends(get_db),
user: UserToken = Security(get_user, scopes=["case_types"]),
user: UserToken = Security(get_user, scopes=["case-types"]),
) -> schemas.CaseType:
item: CaseType = db.query(CaseType).filter(CaseType.id == id_).first()
return case_type_info(item)