How to make available children of Collection Types in Strapi components?

System Information
  • Strapi Version:“3.6.0”
  • Operating System: Mac OS
  • Database: sql little
  • Node Version: v14.15.4
  • NPM Version:
  • Yarn Version:

0

I’ve recently discovered Strapi and I am trying to use it to create a company website, but I’ve got stuck while trying to design the backend structure.

The company offers some packages structured on many levels (like the table from the image) enter image description here  I want all of those items stored in the database and be easily updated or removed. I’ve created 4 collection types: packages, package items, packages levels, packages categories.

enter image description hereenter image description hereenter image description here enter image description here  Everything work as expected, so, I’ve created a component PackageHome that I want to use in another Collection Type: Pages. I want a component to allow me to select some packages and to select one level for each one of them and some items. All those are meant to be used by the client app.

enter image description here  The problem is that even if the “package item” collection type contains the package level relation, I not able to see the levels at which the item “is available”/contained by a level’s package. I can see them in the packages items API, but using components I am not and do not know why.

This is what I receive from PackageHomeComponent:

enter image description here  This is what I want to receive from the component and I receive in the Packages Items API endpoint:

enter image description here

Is there a structural design problem? How can I solve it?

I’ve solved my dilemma by writing a custom controller in which I’ve enriched the data that was sent through API to the frontend. I’ve also found out that I could write a plugin with which I’ve to create another field that lets me choose what I want. I’ve started working but I didn’t finish because I’ve found this easier solution. Anyway, the plugin (a custom field) is the solution for the long term and a more elegant approach.