File tree Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Original file line number Diff line number Diff line change 11from typing import List
22from uuid import UUID
33
4- from fastapi import APIRouter , Depends , HTTPException , status
4+ from fastapi import APIRouter , Depends , status
55from sqlalchemy .orm import Session
66
77from app .dependencies import get_db
@@ -18,10 +18,7 @@ async def get_all_branches(db: Session = Depends(get_db)):
1818
1919@router .get ("/{branch_id}" , response_model = BranchResponse )
2020async def get_branch_by_id (branch_id : UUID , db : Session = Depends (get_db )):
21- branch = repository .get_branch_by_id (db , branch_id )
22- if branch is None :
23- raise HTTPException (status_code = 404 , detail = "Branch not found" )
24- return branch
21+ return repository .get_branch_by_id (db , branch_id )
2522
2623
2724@router .post ("/" , response_model = BranchResponse , status_code = status .HTTP_201_CREATED )
Original file line number Diff line number Diff line change 11from typing import List
22from uuid import UUID
33
4- from fastapi import APIRouter , Depends , HTTPException
4+ from fastapi import APIRouter , Depends
55from sqlalchemy .orm import Session
66
77from app .dependencies import get_db
@@ -18,10 +18,4 @@ async def get_all_students(db: Session = Depends(get_db)):
1818
1919@router .get ("/{student_id}" , response_model = StudentResponse )
2020async def get_student_by_id (student_id : UUID , db : Session = Depends (get_db )):
21- student = repository .get_student_by_id (db , student_id )
22- if student is None :
23- raise HTTPException (status_code = 404 , detail = "Student not found" )
24- return student
25-
26-
27-
21+ return repository .get_student_by_id (db , student_id )
You can’t perform that action at this time.
0 commit comments