Sailsjs delete / update multiple lines

I am working on sailsjs, I created a model and api controller. I'm just wondering if I can publish and create many records of this model, and not use curl on the command line again and again. Does this quiet interface also support the delete method and update method for multiple lines at the same time?

thanks

+5
source share
1 answer

Most of this information is in the docs http://sailsjs.org/#/documentation/reference/blueprint-api

By default, you can create several records at once in one post. Put an array of records to create.

For updating and deleting, I believe you need to set up your drawings to find an array of identifiers. Waterline, the foundation of ORM Sails, supports multi-line creation and deletion, although be sure to turn off associations http://sailsjs.org/#/documentation/reference/waterline/models/update.html?q=notes

To override drawings, create your own drawings in api/blueprints/ for example. api/blueprints/update.js and make them look for an array of identifiers. You probably want to start with the default drawings https://github.com/balderdashy/sails/tree/master/lib/hooks/blueprints/actions .

In addition, you will need to define your own routes, since the update and delete actions are bound by default to PUT 'controller/:id' and DELETE 'controller/:id' respectively, which essentially allows you to use only one id.

+3
source

Source: https://habr.com/ru/post/1202941/


All Articles