Allow readonly domain models take 4 #3928
xenoterracide started this conversation in General
Replies: 1 comment 2 replies
-
| I am not sure what are you proposing here. One thing I can tell you right ahead - the https://github.com/mikro-orm/mikro-orm/blob/master/packages/core/src/typings.ts#L86 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
Sorry, but I have a new idea on this problem, that is perhaps more acceptable, since it only involves type mutation
My current workaround is to treat your repositories like dao's, and expose a readonly interface. However in my rich models I've noticed my rich methods are also exposed on the where filters and such.
note:
StorefrontProductAggregateis somewhat readwrite whileStorefrontProductisDeepReadonly<StorefrontProductAggregate>, this is to avoid the getter/setter issues, whilst protecting the aggregate invariant.the filter parameter for "where" should then be based on
whilst the return should still be the readonly interface of
StorefrontProductI might be able to figure out a patch for this either using ts-essentials, or copy-pasta-ing it
Beta Was this translation helpful? Give feedback.
All reactions