htammen / n-odata-server

Node.js OData Server
http://htammen.github.io/n-odata-server/
MIT License
84 stars 21 forks source link

How to write business logic on Entity creation? #38

Open siddiquipro opened 6 years ago

siddiquipro commented 6 years ago

While creating entity i want to add some business logic and also want to create related entities, Where can i update them ?

@htammen please help as it is important

maxwiese commented 5 years ago

I think you can do this via: https://loopback.io/doc/en/lb3/Adding-application-logic.html . But i can't figure out how that worked with OData.

If you do so, please write me back!

andrii-naumovych commented 5 years ago

@mohammadsiddiqui Basically, what you need is not related to OData component. This is about how loopback's Models work.

I think you need to use "before create" or "persist" operation hooks. There you can do all the needed data manipulations.