day-cohort-70 / rare-api-rare-bear-team-4

rare-api-rare-bear-team-4 created by GitHub Classroom
0 stars 0 forks source link

Feature/create post view #57

Closed nicholas-davison closed 5 months ago

nicholas-davison commented 5 months ago

This pull request adds a new function get_all_posts that retrieves all posts from a SQLite database and formats them as JSON. The function executes a SQL query joining the Posts, Categories, and Users tables to gather comprehensive data about each post. It then constructs a list of post dictionaries, including optional expansion of category and user details based on query parameters. The code ensures efficient database access using context management with sqlite3.connect. Additionally, a placeholder function get_one_post is included, returning a simple string for now.