How would you build out a shared comments collection between a Company and a Jobs Collections?
Would a single comment appear on both a company and job record? Or simply one or the other?
Is a comment editable from either record, or only inserted?
What's the use case?
A single comment would be appear in both, be editable in both.
At a high level, Comments will store a foreign key to the Company and/or Job.
Companies and Jobs will have a relationship (field type) to Comments, which will likely be a virtual field that relies on hooks to return data and set data.
One tricky part is that it is not straight forward to add a Comment from another collection because the modal does not pass (and set) the parent entity in the child entity (modal). Meaning adding a Comment will require that the Company and Job also be set in the modal; this ia something that Directus, for example, does automatically. I'm not sure is Context can help here (I recently learned about it).
There are several GitHub discussions and other discord threads about having support for two way relationships. It needs to be built out and planned still, but this needs to be done.
The current approach is to have hooks in your collections that update relationship fields on both documents which is a pain and obviously not ideal.
I think that's probably okay actually. Just as long as I am on the correct line of thinking and not wasting time building out in the wrong direction.
I'm having this issue personally right now as well. I am looking at evaluating CMSs where this is necessary, it's great to hear Directus does this automatically because it will make me lean towards working with them. It's a shame though, Payload seems great all around other than that.
I spent a few months in Directus, and then found Payload. I have since abandoned Directus and started migrating to payload.
If you want a drag and drop schema builder, Directus is nice. That is not what I wanted as the development process is a nightmare.
The problem relating auto populating the related ID can be resolved with a plugin or UI component.
Gotcha. The only way I could see myself getting that id was from the page url...is there another way to get the id to use in a UI component? What plugin would you suggest otherwise? I agree the developer experience definitely seems to be better for control on payload.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.