Are they different for every single document? Or do you have like 3-4 Schemas that repeat?
Is this where I use a DTO?
Delta. Tango. Oscar.
On my Document/Contract project.. I have about 8 document types (so far). All with different values. I opted to store the values in a values column on the document, no judgments please. I'm a grown up... mostly.
First pass, I made anonymous blade components for each document template and defined the values as props at the top, for sanity.
Now, I'm to the document making part of this journey. I want to choose a document and fill in the values. AND then I started thinking - that may be the issue. This isn't a standard "post" or "user" and I don't want to be chasing value definitions all over the place.
Is this where I use a DTO? Essentially making a template with the required values. Maybe DTOs aren't quite right.
You get me? Elegant solution?
[
"name" => "Letter of Intent"
"values" => [
"price" => 190000,
"seller_finance_amount" => 9500,
"interest_rate" => 6,
"psa_execution_deadline" => "2023-02-27T00:00:00.000000Z",
"days_for_due_diligence" => 14,
"days_for_exclusivity" => 30,
"other_terms" => "the sale includes a) one month of in-store training, b) a non-compete provision suitable for SBA lender",
],
]
[
"name" => "Allocation of purchase price",
"values" => [
"price" => 190000,
"allocation" => [
"inventory" => 5000,
"accounts_receivable" => null,
"ffe" => 15000,
"training_transition" => 8000,
"non_compete_consideration" => 15000,
"other" => null,
],
],
]
[
"name" => "Contingencies to purchase agreement",
"values" => [
"contingencies_deadline" => "2023-02-27T00:00:00.000000Z"
],
]
@webrobert Then that would mean 8 diffferent types of DTO's. One for each "shape". The idea of a DTO is that you pass in the data, it holds it form (readonly) and you get the same form out again.. And the DTO in your case sounds be one the "values". Hard to say if it makes sense in your context. but it would make sure you can predict the data.
Please or to participate in this conversation.