Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create comment service #183

Merged
merged 8 commits into from
Feb 20, 2024
Merged

Create comment service #183

merged 8 commits into from
Feb 20, 2024

Conversation

MartinBenediktBusch
Copy link
Collaborator

@MartinBenediktBusch MartinBenediktBusch commented Feb 19, 2024

Overview

This PR implements functionalities that allow to save a comment to the database and retrieve comments related to a specific question option. Important, I explicitly did not implement functionality to edit/update a comment. This is something that could be done in a further PR as it is an additional feature.

Changes Implemented

1. saveComment Function

  • This function handles the process of saving a comment to the database. It calls the upsertComment function to insert or update the comment in the database.
  • Upon successful insertion or update, it returns a JSON response containing the inserted/updated comment data.

2. insertComment Function

  • This function performs the actual insertion or update of a comment in the database.
  • It receives the database pool connection, comment data, and user ID as parameters.

3. getCommentsForOption Function

  • This function retrieves comments related to a specific question option from the database.
  • Upon successful retrieval, it returns a JSON response containing the retrieved comments.

@MartinBenediktBusch MartinBenediktBusch self-assigned this Feb 19, 2024
@MartinBenediktBusch MartinBenediktBusch marked this pull request as draft February 19, 2024 14:56
@MartinBenediktBusch MartinBenediktBusch linked an issue Feb 19, 2024 that may be closed by this pull request
@MartinBenediktBusch MartinBenediktBusch marked this pull request as ready for review February 19, 2024 16:50
src/routers/comments.ts Outdated Show resolved Hide resolved
src/services/comments.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@diegoalzate diegoalzate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small change

src/routers/options.ts Outdated Show resolved Hide resolved
@MartinBenediktBusch MartinBenediktBusch added the minor A minor change is included in this PR label Feb 20, 2024
@MartinBenediktBusch MartinBenediktBusch removed the minor A minor change is included in this PR label Feb 20, 2024
@MartinBenediktBusch MartinBenediktBusch merged commit 2bb2e20 into develop Feb 20, 2024
3 checks passed
@MartinBenediktBusch MartinBenediktBusch deleted the comment-service branch February 20, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comments service
2 participants