Skip to content

Commit

Permalink
chore: making response data dict concise
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonNotJson committed Sep 18, 2023
1 parent 7d5a4e6 commit 4029dd7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lambda/get-user-threads/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ def get_user_threads(uid=""):
thread_ids = [item['thread_id'] for item in results]

# Determine the response data based on new_comment_count
response_data = True if new_comment_count > 1 else {
'thread_ids': thread_ids, 'new_comment_count': new_comment_count}
response_data = {
'thread_ids': thread_ids,
'new_comment_count': new_comment_count,
'new_comment_flag': new_comment_count > 1
}

body = JsonPayloadBuilder().add_status(True)\
.add_data(response_data)\
.add_message('Fetched successfully').compile()
.add_message('').compile()

return body

Expand Down

0 comments on commit 4029dd7

Please sign in to comment.