Users can join projects.
Projects can have many tasks.
Each user completes the task at their own time, they can also have some other user specific settings on the task like the priority in their todo list and whether to hide it on completion or not.
The problem I'm facing is that some of these settings must have default values e.g. priority = 0, hideOnComplete = true.
These must be available to the client for each project user at all times. How do I make that the TaskUser rows with the default values for the each user exist at all times?
I create a TaskUser relation for every user in the project each time a new task is added to the project.
I create a new TaskUser relation for each task in the project every time a new user joins the project.
I don't think this is the way to go since you have to be reacting to these events all the time and acting in response.
Duplicate the default fields in the Task table. I include a priority and hideOnComplete field in the Task table. The client can then know what what to display on Task setting forms even if the TaskUser relation doesn't exist.
I no longer have to react to new users or tasks. A client can request the task object and populate the settings form with the default fields even when there is no TaskUser relation. Afterwards, when the users submits his own settings the client can look into the existing TaskUser relation for the correct values.
This seems to be a much better option to me. What do you think?