Skip to content

Commit

Permalink
problem with movie_id(src\routes\movies.py)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stekloduv committed Feb 10, 2025
1 parent 6643329 commit 4da60ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/routes/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,10 @@ def get_movie(movie_id: int, db: Session = Depends(get_db)):
raise HTTPException(status_code=404, detail="Movie with the given ID was not found.")
return db_movie


@router.post("/movies", response_model=MovieDetail, tags=["movies"])
def create_movie(movie: MovieCreate, db: Session = Depends(get_db)):
db_movie = MovieModel(**movie.model_dump())
db.commit()
db.refresh(db_movie)
return db_movie

0 comments on commit 4da60ad

Please sign in to comment.