add /catalog route
This commit is contained in:
parent
5fd50065cb
commit
e1ab344279
@ -30,8 +30,8 @@ class PostCreate(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
@app.get('/', status_code=status.HTTP_200_OK)
|
@app.get('/', status_code=status.HTTP_200_OK)
|
||||||
async def get_threads(db: db_dependency):
|
async def get_posts(db: db_dependency):
|
||||||
return db.query(Thread).all()
|
return db.query(Post).all()
|
||||||
|
|
||||||
|
|
||||||
@app.post('/', status_code=status.HTTP_201_CREATED)
|
@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')
|
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()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user