Answer the question
In order to leave comments, you need to log in
How to store payment templates?
We create an application for generating payments. A person answers a questionnaire and sees the result right on the fly. But how to store these payment templates correctly? There is such an option:
Template
id
name - template name
text - HTML code of the template. Then we convert it to PDF, Word, etc.
Question
id
text - the text of the question itself
template_id
order - the order of the question in the questionnaire
answer_type_id - the type of answer (string, radio button, slider, etc.)
Answer
id
question_id
payment_id
data (JSON with the answer)
Payment is a ready-made document. So that the progress of the answers is not lost.
id
name
user_id
Please tell me about the disadvantages of such a scheme.
Answer the question
In order to leave comments, you need to log in
It is difficult to say without knowing the implementation details and the nuances and specifics of the subject area. Outwardly, it looks ok, the only thing that is not clear is that the questionnaire involves a sequence of actions with an intermediate result, as I understand it, the resumption will be formed from the answer table?
A small touch - the order SQL keyword, in general, it's not scary, the orm processes it normally, but I usually replace it with sort.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question