Closed Muzea001 closed 1 week ago
approve please @uerbzr
Add the missing CRUD operations for the Post-object.
(UpdateById is created in another issue)
Added new endpoints for post:
Updated endpoints for:
New files:
Updated files:
All endpoints require the user to be logged in.
getById fetches a post with an id input parameter. updateById updates a post with an id input parameter and content body. deleteById deletes a post with and id input parameter. create creates a new post for the logged in user with a content body. getAll fetches all posts.
the domain/post.js file contains all database calls, and follows the format of the already existing domain/user.js. the controllers/post.js file is updated with all endpoint logic and error handling. the docs/openapi.yml is updated with the new endpoints and a new UpdatePost-schema. the prisma/schema.prisma is updated with two new fields for the post model (createdAt, updatedAt)
Parent EPIC: https://github.com/boolean-uk/team-dev-client-ex-2410-team2/issues/6