I have to create a system to interview people on a few topics where they have to answer both objective and discursive questions, where questions may change between interviews. I structured the database in the following manner:
- Interviewis a table with the user's e-mail and timestamps.
- Objective/Discursive Answersfields are the- Interviewkey, the- Objective/Discursive Questionskey and the answer that may be a string for discursive answers and a bool (true/false) for the objective ones.
- Objective/Discursive Questionis just the description of the question.
- All tables use artificial keys.
So, we have these kind of relationships:
Interview 1 - n Objective Answers n - n Objective Questions
Interview 1 - n Discursive Answers n - n Discursive Questions
When the user lands into the interview page, they will face a single form, where these types of questions will be distributed. So, when they submit it, all the answers are going to be together.
Should the InterviewController handle this request? Or it must be specifically used for normal operations of the Interview model such as create and delete? I was thinking about creating another such as InterviewAnswersController, even though there is no corresponding model of it, to handle the request.
The same goes for repositories. Since I'm operating three tables simultaneously, I suppose there should also be an InterviewAnswers repository, where it will at first create the Interview in the database and, using its key, in a single transaction insert the answers in the database.