boolean-uk / team-dev-server-ex-2410-team2

1 stars 0 forks source link

Create CRUD functionality for "Post" domain and endpoints #14

Closed Muzea001 closed 1 week ago

JHalvor commented 2 weeks ago

Parent EPIC: https://github.com/boolean-uk/team-dev-client-ex-2410-team2/issues/6

JHalvor commented 2 weeks ago

approve please @uerbzr

eyvmal commented 2 weeks ago

Add the missing CRUD operations for the Post-object.

(UpdateById is created in another issue)

eyvmal commented 2 weeks ago

Added new endpoints for post:

Updated endpoints for:

New files:

Updated files:

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)