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