graphiti-api/spraypaint.js

Bulk creating

Opened this issue · 2 comments

How can use this library to bulk create?
There is nested updating, but I didn't see anything about bulk create (with nested attributes).

Can you explain the problem in more detail? I've personally never encountered a use case that called for directly triggering a bulk create in client-side code. If you're using relational database, Spraypaint helps you by performing all needed operations (create, update, delete) simply by calling the save() method on the parent record. So, say you had a User model that "had many" notes, and you wanted to bulk-create many notes at once, all you'd need to is 1) ensure the relationship is described correctly in the Spraypaint model file, 2) attach the new notes to the User record (e.g. User.notes = [// a lot of notes], and run User.save()

I've stopped using spraypaint.js. What I'm referring to is atomic requests in JSON:API, it helps when we need to batch creation and minimize network requests.