Skip to content

POST with array of objects in payload #3532

@JyotiRani

Description

@JyotiRani

I have a requirement to set an autogenerated field to the incoming payload of POST request. I have defined 'before save' operation hook in my loopback application which does this. However for payload with single object, it works as expected, but if i have array of objects in payload, then the autogenerated field is set same for all objects in the array while i want different value to be saved for all objects. So i am wondering what is the best place/hook to modify each object in array uniquely.

Note: the autogenerated field is fetched from db, and is incremented after every fetch, so next object in array should use the incremented value and so on.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions