I have two closely related DataTypes (Contracts and Documents) and am having trouble figuring out which one should be the ‘Thing’ to attach a private uploaded file to.
I’ve set out the full background below.
I have two DataTypes: Contract and Document.
The Contract DataType includes a Field called Documents (type: List of Documents).
The Document DataType includes a Field called Contract (type: Contract). It also includes a Field called File (type: file).
The idea being that each Document can be associated with one Contract and each Contract can be associated with many Documents. Uploaded files are added to the Documents DataType rather than directly to a list of files in the Contracts DataType to allow them to be given a title, description etc.
I would like users be able to upload files associated with a particular Contract (i.e. users upload files which are separate Documents which are associated with a Contract) and make sure all uploaded files are Private.
Question: Which Thing should the Private uploaded files be ‘attached’ to: Documents or Contracts? Would I just choose depending on whether I want to control privacy via Documents or Contracts?
If Private uploaded files should be attached to Documents, I’ve noticed that I will have an issue in that I want to create a Document from the uploaded file, but I need an existing Document to attach the uploaded file to (see here).
If Private uploaded files should be attached to Contracts, does this ‘cut across’ the idea of having files stored only on the Document thing? i.e. in this case the file is “Attached to” a Contract, but the Contract DataType does not actually hold file: