Ejemplo n.º 1
0
    params:function (v) {
        var p = [
            param.q('skip', 'number of records to skip', 'int', false, false, null, 0),
            param.q('limit', 'limit the number of records', 'int', false, false, null, 10)
        ]
        var filters = [], sort = [], populate = [];
        _u.each(v.schema, function (vv, k) {

//            var k = vv.path;
            if (k == 'id')
                return;
            var type = vv.schemaType;
            if (type == 'Date' || type == 'Number' || type == 'String') {
                filters.push(param.q('filter[' + k + ']', 'filter '+type +' fields on ' + k + ' supports >, < modifiers', 'string', false, false));
                sort.push(param.q('sort[' + k + ']', 'sort on ' + k + ' direction ascending 1, descending -1', 'int', false, false, [1, -1], 1));
            } else {
                populate.push(k)
            }

        })
        if (populate.length) {
            p = p.concat(param.q('populate', 'populate field', 'string', false, true, populate))
        }
        return  p.concat(filters, sort);
    }
Ejemplo n.º 2
0
        _u.each(v.schema, function (vv, k) {

//            var k = vv.path;
            if (k == 'id')
                return;
            var type = vv.schemaType;
            if (type == 'Date' || type == 'Number' || type == 'String') {
                filters.push(param.q('filter[' + k + ']', 'filter '+type +' fields on ' + k + ' supports >, < modifiers', 'string', false, false));
                sort.push(param.q('sort[' + k + ']', 'sort on ' + k + ' direction ascending 1, descending -1', 'int', false, false, [1, -1], 1));
            } else {
                populate.push(k)
            }

        })