-
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
find*
methods include navigational properties
#2960
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start!
I feel the changes in CLI are going in wrong direction and adding unnecessary complexity, let's discuss.
1349735
to
aa8522b
Compare
aa8522b
to
eee47ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there!
In the new commits, I added empty interfaces because I think they should be populated only after #2633 is landed. What do you think?
I am not sure if I understand your question correctly.
IMO, when a model already has some relations defined, then the *Relations
interface should have the navigational properties defined too. We will need these navigational properties for our next steps on the journey to implement the feature "inclusion of related models".
As I see it, #2633 is about automating the task of adding navigational properties. Until it's done, developers will have to define these properties manually, which is exactly what I am asking you to do in this pull request too.
packages/repository/src/__tests__/fixtures/models/address.model.ts
Outdated
Show resolved
Hide resolved
packages/repository/src/__tests__/fixtures/models/order.model.ts
Outdated
Show resolved
Hide resolved
bb2703c
to
35c43d8
Compare
I thought the purpose of #2633 was only to add them to the Also, did you mean #2988 was for automating instead of #2633? |
38e42e4
to
5d5450e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👏
5d5450e
to
a8c4c26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👏 LGTM.
2ddd367
to
10bea99
Compare
Updated find* methods to include navigational properties, introduced *Relations to models, and updated DefaultCrudRepository to include Relations Co-authored-by: Miroslav Bajtoš <[email protected]>
10bea99
to
9d8d232
Compare
Resolves #2632.
find
andfindById
now useT & Relations
instead ofT
lb4 model
that asks for relations in order to create the relation interface (e.g.export interface TodoRelations {}
). It leaves it empty if there are no current relations.lb4 model
include{modelName}WithRelations
type (e.g.export type TodoWithRelations = Todo & TodoRelations;
)Relations
added toDefaultCrudRepository
lb4 repository
, it now includes{modelName}Relations
(e.g.)
Question: should all models include a relations interface? If so, I'll update the examples/docs.
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈