From e1ab3442798b689da995d9d492d21e9483655d92 Mon Sep 17 00:00:00 2001 From: agatha Date: Fri, 5 Apr 2024 19:28:27 -0400 Subject: [PATCH] add /catalog route --- backend/main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/main.py b/backend/main.py index ca98e5d..3ccf1c4 100644 --- a/backend/main.py +++ b/backend/main.py @@ -30,8 +30,8 @@ class PostCreate(BaseModel): @app.get('/', status_code=status.HTTP_200_OK) -async def get_threads(db: db_dependency): - return db.query(Thread).all() +async def get_posts(db: db_dependency): + return db.query(Post).all() @app.post('/', status_code=status.HTTP_201_CREATED) @@ -96,3 +96,9 @@ async def create_reply(db: db_dependency, data: PostCreate, thread_id: int = Pat } raise HTTPException(404, f'Could not find thread') + + +@app.get('/catalog', status_code=status.HTTP_200_OK) +async def get_catalog(db: db_dependency): + return db.query(Thread).all() +