FairPlaySocial icon indicating copy to clipboard operation
FairPlaySocial copied to clipboard

Add support for posting Polls

Open efonsecab opened this issue 2 years ago • 2 comments

Create the table Poll, with the following columns

  • PollId BIG INT NOT NULL IDENTITY
  • Text NVARCHAR(50) NOT NULL
  • DurationDays TINYINT NOT NULL
  • OwnerApplicationUserId Foreing Key to ApplicationUser.ApplicationUserId Add the IOriginatorInfo interface columns

Create a new table PollOption with the following columns

  • PollOptionId BIG INT NOT NULL IDENTITY
  • PollId BIG INT Foreign Key to Poll.PollId
  • Text NVARCHAR(20) NOT NULL
  • Add the IOriginatorInfo interface columns

In the Post table, add the following column

  • PollId, BIGINT NULLABLE Foreing Key to Poll.PollId

Create the table PollResponse with the following columns

  • PollResponseId BIGINT NOT NULLABLE IDENTITY
  • PollOptionId BIG INT Foreign Key to PollOption.PollOptionId
  • RespondentApplicationUserId Foreign Key to ApplicationUser.ApplicationUserId
  • Add IOriginatorInfo interface columns

Regenerate the data access

Create the models: PollModel, CreatePollModel, PollOptionModel, CreatePollOptionModel

To the CreatePostModel, add a new property Poll of type CreatePollModel

In the Create Post Page, add a new option to create a poll, along with 4 options (possible answers)

Modify the PostComponent so that if renders the Poll if there is one available. When a user click the post option radio button, update the poll response, using an endpoint public async Task<IActionResult> PollResponseController.CreatePollResponseAsync(CreatePollResponseModel createPollResponseModel, CancellationToken cancellationToken) You will need to create the respective client service for that endpoint

If there is already a response from the same user to the same poll, the existent response will be deleted by the endpoint before adding the new one.

When viewing posts, it should show the % of answers for each option. Once the user has chosen an option in the poll, if the user clicks on any of the options, it will show a modal listing the users who chose that option.

For the moment, we will not allow to edit the selected option in polls

efonsecab avatar Dec 22 '22 19:12 efonsecab

Can I take this one?

dsm637 avatar Feb 03 '23 02:02 dsm637

Can I take this one?

Hello @dsm637, sure, go ahead, check LinkedIn Polls functionality, that's kind of what we want, especially the ability to see the list of users who voted and how they voted

efonsecab avatar Feb 03 '23 12:02 efonsecab