dimanche 4 juillet 2021

How to reference new collection in a Model, after the initial design was designed to only refer to one?

Right now, I have a collection called article, with all my articles. Each has a unique id, for example: ABC. Then I have a collection called paragraph which stores the article id, so i know which article each paragraph belongs to. Each paragraph also holds a numeric field called position, so I know which order they appear in in the article (1,2,3..). The article itself doesn't store any information about what paragraphs are inside it.

Now I've recently realised that I also want to also have Images between my paragraphs. So an article might be:

Paragraph
Paragraph
Image
Paragraph
...

But I am not sure how to now make this work!

One solution I came up with was to change my paragraph collection to also include images, so I could rename the collection to items and then store everything in there. But this doesn't seem very neat?

PS: For other reasons / requirements that would be too cumbersome to get into here, the solution can't be that I just move my paragraphs & images inside article.

Aucun commentaire:

Enregistrer un commentaire