-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Update TodoList example and model relations pages to use lb4 relation
command
#3742
Comments
You could always mount lb3 app in lb4. Personally I absolutely love Typescript implementation. JS is teribad. |
@ichtestemalwieder, thanks for your feedback. The TodoList example was created before we have the tooling around relations, so the developer experience is a bit clumsy that way. With the
I think our docs should be updated to reflect that. If you agree, I'd like to convert this GitHub issue into a docs issue to update the TodoList example or possibly docs pages related to model relations. What do you think? |
Thanks very much for the answer. This is great news, as it defenitely solves one part of the problem Yes of course the ticket can be converted to a doc issue. The Docs in general are great! But that concrete example lacks any background explanation why there are several dedicated Classes/Interfaces for the relations. And why it is implemented as "Constrained Repositories". I know what they are doing, but I still wonder why such a complex construct is used. |
Thanks @ichtestemalwieder. I think another way to make the documentation clearer is to separate the usage and the minimal concept/info you need to know in order to use it from the detailed explanation. Anyway, I'd like to invite you to review the PR(s) coming from this task. :) I've also added the acceptance criteria. Please let me know if I miss anything. Thanks. |
lb4 relation
command
Hi, What is wrong in my changes ? Is it possible to do it ? |
@sestienne, we just finished the Once we've published a release (possibly very soon), it's possible to do it. |
@sestienne Hi! unfortunately we don't have such a way to create an instance along with its related instance in one post request. There are some reasons that we don't support. For example, users might use two different databases for two different models. So we want it to be more flexible. As for the inclusion resolver @dhmlau mentioned above, the new feature allows us to query related instances easily.
Please let me know if you have any questions. |
@dhmlau @agnes512 Thanks a lot for your messages, it's a very good news ! While I was waiting for a response, I've tried on a poc workaround but it's not clean nor graceful. Here is an example. The controller uses two repositories to do this :
Note that the block doesn't actually manage transactions. |
Hello,
I rewrote the issue, as I realized, that LB V4 is still in it's infancy and will become more declarative in the future... But I am not the only one complaining, quoting:
"... An example? This is the code necessary to define a one-to-many relationship in Loopback 3:
Here is the same type of relationship defined in Loopback 4:
..."
Examples normally showcase the "greatness" of something. But the concrete TODO List Example rather shows, that is way more complex to setup a oneToMany Relationship than in any other JS framework. Also in Spring Boot such an example is way more concise and intuitive. So the question is, how this can be solved.
A concrete example what feels so unintuitive (in the TODO List Example):
I am new to TS, but most likely this is more of an architectural problem: Why do we need extra interfaces for the relationships and type aliasing? Why is not information about persistance put into decorators and the models just model the relation on an object/entity level, so you can get rid of the type alias and the extra interfaces (like below in pseudo code)...?
This is not meant as a critique. I looked at many frameworks and was so happy finding one that has features like DI/IOC, Repositories, Decorators, TypeScript... But than looking at the examples I got so disappointed as it feels not intuitive. So the question is, how can this be improved. Thanks.
Acceptance Criteria
added by @dhmlau per this comment
Now that we have
lb4 relation
, we should make sure our docs reflect this change.The text was updated successfully, but these errors were encountered: