Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Comments shared between Company and Job Collections

default discord avatar
joelcoreylast year
8

How would you build out a shared comments collection between a Company and a Jobs Collections?

  • default discord avatar
    brianjmlast year

    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?

  • default discord avatar
    joelcoreylast year

    A single comment would be appear in both, be editable in both.

  • default discord avatar
    brianjmlast year

    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).

  • discord user avatar
    dribbens
    last year

    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.

  • default discord avatar
    joelcoreylast year

    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.

  • default discord avatar
    daggertoeslast year

    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.

  • default discord avatar
    brianjmlast year

    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.

  • default discord avatar
    daggertoeslast year

    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 on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.