refactor: move unknown parent thread check

This commit is contained in:
agatha 2024-03-31 23:57:09 -04:00
parent 002fc63c90
commit 4228107b54

View File

@ -95,7 +95,9 @@ async def reply_to_post(thread_id: int, data: PostCreate):
if thread.id == thread_id:
parent = thread
if parent:
if parent is None:
return {'error': 'could not find parent thread'}
id = len(POSTS) + 1
author = data.author
title = data.title
@ -112,5 +114,3 @@ async def reply_to_post(thread_id: int, data: PostCreate):
POSTS.append(post)
return post
return {'error': 'could not find parent thread'}