Skip to content
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

How to get Ids of entities #12

Open
Pipo93 opened this issue Apr 7, 2023 · 2 comments
Open

How to get Ids of entities #12

Pipo93 opened this issue Apr 7, 2023 · 2 comments

Comments

@Pipo93
Copy link

Pipo93 commented Apr 7, 2023

I have a question regarding entities. I can't see anything regarding Ids in the entities and the create as well as the get endpoints are returning elements of those entities. How can the clients then know which id they need to send to update/ delete for example an author or book?
I assume something is missing and it just works because although typescript does not know about the ids Mongoose returns them with the responses.

@jemsgit
Copy link

jemsgit commented Dec 1, 2023

Hi! Have the same question. I think we can't find anything in our repository by Id because client can't get Id from our models.

@alande-amorim
Copy link

@Pipo93 is you domain entity really expected to have an id property? Is it part of your Critical Business Rules? Or is the id a database commodity? Does it make part of your domain entity or to your database model?

"An Entity is an object within our computer system that embodies a small set of critical business rules operating on Critical Business Data. The Entity object either contains the Critical Business Data or has very easy access to that data. The interface of the Entity consists of the functions that implement the Critical Business Rules that operate on that data."(Martin, Robert C. Clean Architecture. Boston: Prentice Hall, 2017, 186.)

also

"... many database frameworks return a convenient data format in response to a query. We might call this a “row structure.” We don’t want to pass that row structure inward across a boundary. Doing so would violate the Dependency Rule because it would force an inner circle to know something about an outer circle." (p. 200)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants