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

Discussion: Should domain API take primary key as an argument or the entire record? #27

Open
saurabhnanda opened this issue Oct 15, 2016 · 2 comments

Comments

@saurabhnanda
Copy link
Contributor

should functions like activateTenant or editProduct take a TenantID or ProductID as input OR Tenant or Product

@jfoutz
Copy link

jfoutz commented Oct 15, 2016

Tenant vs TenantID, Requiring a Tenant seems to indicate a select before an update. the Tenant record needs to be populated, then modified based on the query params, then finally sent back across the domain API for an update. You can say semantics indicate the Tenant record is just the differences between what's in the db and the current object, so just update the populated fields. That approach seems confusing for insert though. I like ID, but i'd like to see a slick alternative.

@wz1000
Copy link
Collaborator

wz1000 commented Oct 15, 2016

The semantics of those are quite different. A Tenant is a pure Haskell value, while a TenantId is a reference to a mutable resource. This distinction makes which to use when quite clear. If you are only performing pure transformations to a value, then Tenant should be used. Otherwise you need TenantId

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

No branches or pull requests

3 participants