jxmono / crud

:fork_and_knife: CRUD for mono
MIT License
0 stars 1 forks source link

Get all templates #2

Closed dooma closed 11 years ago

dooma commented 11 years ago

To retrieve all templates from datasource, which is the best solution, getTemplates or find ? In case we use find, we should pass a crudObject, but if we use getTemplates, we could pass [] and the server should return all docs.

var crudObj = {
            t: config.options.type,
            q: query,
            o: options,
            f: {
                "$all": 1,
                "_id": 0
            }
        };

self.emit("find", crudObj, callback);

vs.

self.emit("getTemplates", [], callback)
ottiker commented 11 years ago

Receive all templates is at the moment only possible with find. But I will change the getTemplates operation, so that you can receive all templates which a user has access to.

ottiker commented 11 years ago

Now it's possible to receive all templates with getTemplates.

self.emit('getTemplates', function (err, data) {});
// ..or
self.emit('getTemplates', [], function (err, data) {});

Fixed in 86e859253860a413805842741b2ebc59ecc6a2b1