code4romania/monitorizare-vot

Add new endpoint for deleting a form section

aniri opened this issue · 3 comments

aniri commented

Add a new endpoint: DELETE ​/api​/v1​/form/section that receives a section id and will delete the form section. It will also delete the entities linked to that form section: questions, options, options to questions.

If there are already answers saved for any of the linked questions, it should throw a 400 error.

The endpoint should only be available for organizer admins.

Hello,

I can take this one if no one was assigned yet.

Meanwhile, I found a few non-blocking questions related to this task:

  1. The organizer admin is a separate role than the organizer?
  2. What is the role for these form sections inside the platform? I mean how do they work?
    Are there any prefilled surveys that an observer can fill?

Thanks!
Marius

aniri commented

Hello,

I can take this one if no one was assigned yet.

Meanwhile, I found a few non-blocking questions related to this task:

  1. The organizer admin is a separate role than the organizer?
  2. What is the role for these form sections inside the platform? I mean how do they work?
    Are there any prefilled surveys that an observer can fill?

Thanks!
Marius

@marius-jantea Thanks for helping with this.

  1. they are the same 👍
  2. yes the platform is mostly for configuring some forms that the user can fill in and viewing the answers and stats 😃 forms are made up of sections and the sections have questions 😃

Hello, from what I observed in the code, the Options table is independent from Question entity, and indirectly from Section entity.. As you already mentioned, there is a table in the database, OptionsToQuestions, that keeps the assignment between questions and options.
If when a Section is removed, we remove the options used as well, then those options will not be available for other questions in the future. Also, part of the options can be common for questions that are in different sections - by removing a section, we cannot remove all the options assigned to the questions under it due to that reason..
One suggestion would be to leave the Options table as it is.. or add a flag to it (either default option or custom option), where we evidence the options that can be shared between questions and which options are unique / question.
Looking forward for your feedback on this.
Thanks!