simonedelmann / crud-kit

CRUD for Vapor 4. We all write CRUD (Create-Read-Update-Delete) routes all the time. The intention of this package is to reduce repeating code and to provide a fast start for an API.
MIT License
56 stars 8 forks source link

Children relationship doesn't work multilevels deep for crud() #8

Closed jcbriones closed 3 years ago

jcbriones commented 3 years ago

Hey simone! Just want to say great work on this! This has help me a lot and reduce my lines of code. I appreciate you sharing this.

I have a few questions though.

I was trying something that looks like it's not currently supported? First, I am trying to do multilevel CRUD siblings. I am trying to do something where it goes two levels deep but it doesn't allow me to do so. It works on the first level but that is it.

Sample:

routes.crud("State", model: State.self) { (sroute, sparent) in
    sroute.crud("County", children: County.self, on: sparent, via: \.$county) { (croute, cparent) in
        croute.crud("City", children: City.self, on: cparent, via: \.$city)
    }
}

Sample DB Relation: State -> County -> City

Also, looks like this doesn't support siblings relationship?

simonedelmann commented 3 years ago

Thank you for your issue! I am glad this library still helps someone even though it is not actively maintained anymore. (I should maybe add a note in the readme 🤔)

Unfortunately, I am afraid both of your requests (sibling relations + deeply nested relationships) are currently not supported. But please feel free to create a PR or even to fork and further develop the library.