add /catalog route

This commit is contained in:
agatha 2024-04-05 19:28:27 -04:00
parent 5fd50065cb
commit e1ab344279

View File

@ -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()