Skip to content

Fix : remove count limit #772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions spec/LogsRouter.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
'use strict';

const request = require('request');
var LogsRouter = require('../src/Routers/LogsRouter').LogsRouter;
var LoggerController = require('../src/Controllers/LoggerController').LoggerController;
var FileLoggerAdapter = require('../src/Adapters/Logger/FileLoggerAdapter').FileLoggerAdapter;
Expand All @@ -23,7 +20,7 @@ describe('LogsRouter', () => {
var router = new LogsRouter();

expect(() => {
router.validateRequest(request);
router.handleGET(request);
}).not.toThrow();
done();
});
Expand All @@ -43,23 +40,28 @@ describe('LogsRouter', () => {
var router = new LogsRouter();

expect(() => {
router.validateRequest(request);
router.handleGET(request);
}).toThrow();
done();
});

it('can check invalid master key of request', done => {
request.get({
url: 'http://localhost:8378/1/scriptlog',
json: true,
headers: {
'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest'
it('can check invalid master key of request', (done) => {
// Make mock request
var request = {
auth: {
isMaster: false
},
query: {},
config: {
loggerController: loggerController
}
}, (error, response, body) => {
expect(response.statusCode).toEqual(403);
expect(body.error).toEqual('unauthorized: master key is required');
done();
});
};

var router = new LogsRouter();

expect(() => {
router.handleGET(request);
}).toThrow();
done();
});
});
4 changes: 2 additions & 2 deletions spec/ParseGlobalConfig.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ describe('a GlobalConfig', () => {
'X-Parse-REST-API-Key': 'rest'
},
}, (error, response, body) => {
expect(response.statusCode).toEqual(403);
expect(body.error).toEqual('unauthorized: master key is required');
expect(response.statusCode).toEqual(401);
expect(body.error).toEqual('unauthorized');
done();
});
});
Expand Down
31 changes: 7 additions & 24 deletions spec/ParseRole.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,17 @@ describe('Parse Role testing', () => {
});

});

it("should recursively load roles", (done) => {

var rolesNames = ["FooRole", "BarRole", "BazRole"];

var createRole = function(name, parent, user) {
var role = new Parse.Role(name, new Parse.ACL());
var role = new Parse.Object("_Role")
role.set("name", name);
if (user) {
var users = role.relation('users');
users.add(user);
users.add(user);
}
if (parent) {
role.relation('roles').add(parent);
Expand All @@ -77,7 +78,7 @@ describe('Parse Role testing', () => {
}
var roleIds = {};
createTestUser().then( (user) => {

return createRole(rolesNames[0], null, null).then( (aRole) => {
roleIds[aRole.get("name")] = aRole.id;
return createRole(rolesNames[1], aRole, null);
Expand All @@ -101,23 +102,5 @@ describe('Parse Role testing', () => {
});
});

it("_Role object should not save without name.", (done) => {
var role = new Parse.Role();
role.save(null,{useMasterKey:true})
.then((r) => {
fail("_Role object should not save without name.");
}, (error) => {
expect(error.code).toEqual(111);
role.set('name','testRole');
role.save(null,{useMasterKey:true})
.then((r2)=>{
fail("_Role object should not save without ACL.");
}, (error2) =>{
expect(error2.code).toEqual(111);
done();
});
});
});

});

26 changes: 0 additions & 26 deletions spec/PromiseRouter.spec.js

This file was deleted.

44 changes: 0 additions & 44 deletions spec/features.spec.js

This file was deleted.

12 changes: 6 additions & 6 deletions spec/schemas.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ describe('schemas', () => {
json: true,
headers: restKeyHeaders,
}, (error, response, body) => {
expect(response.statusCode).toEqual(403);
expect(body.error).toEqual('unauthorized: master key is required');
expect(response.statusCode).toEqual(401);
expect(body.error).toEqual('master key not specified');
done();
});
});
Expand All @@ -110,8 +110,8 @@ describe('schemas', () => {
json: true,
headers: restKeyHeaders,
}, (error, response, body) => {
expect(response.statusCode).toEqual(403);
expect(body.error).toEqual('unauthorized: master key is required');
expect(response.statusCode).toEqual(401);
expect(body.error).toEqual('master key not specified');
done();
});
});
Expand Down Expand Up @@ -206,8 +206,8 @@ describe('schemas', () => {
className: 'MyClass',
},
}, (error, response, body) => {
expect(response.statusCode).toEqual(403);
expect(body.error).toEqual('unauthorized: master key is required');
expect(response.statusCode).toEqual(401);
expect(body.error).toEqual('master key not specified');
done();
});
});
Expand Down
12 changes: 0 additions & 12 deletions src/Adapters/Files/FilesAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@
// database adapter.

export class FilesAdapter {
/* this method is responsible to store the file in order to be retrived later by it's file name
*
*
* @param config the current config
* @param filename the filename to save
* @param data the buffer of data from the file
* @param contentType the supposed contentType
* @discussion the contentType can be undefined if the controller was not able to determine it
*
* @return a promise that should fail if the storage didn't succeed
*
*/
createFile(config, filename: string, data, contentType: string) { }

deleteFile(config, filename) { }
Expand Down
4 changes: 0 additions & 4 deletions src/Adapters/Push/ParsePushAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ export class ParsePushAdapter extends PushAdapter {
super(pushConfig);
this.validPushTypes = ['ios', 'android'];
this.senderMap = {};
// used in PushController for Dashboard Features
this.feature = {
immediatePush: true
};
let pushTypes = Object.keys(pushConfig);

for (let pushType of pushTypes) {
Expand Down
53 changes: 0 additions & 53 deletions src/Adapters/Storage/Mongo/MongoCollection.js

This file was deleted.

8 changes: 0 additions & 8 deletions src/Adapters/Storage/Mongo/MongoStorageAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

import MongoCollection from './MongoCollection';

let mongodb = require('mongodb');
let MongoClient = mongodb.MongoClient;

Expand Down Expand Up @@ -32,12 +30,6 @@ export class MongoStorageAdapter {
});
}

adaptiveCollection(name: string) {
return this.connect()
.then(() => this.database.collection(name))
.then(rawCollection => new MongoCollection(rawCollection));
}

collectionExists(name: string) {
return this.connect().then(() => {
return this.database.listCollections({ name: name }).toArray();
Expand Down
6 changes: 1 addition & 5 deletions src/Controllers/AdaptableController.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ export class AdaptableController {
this.options = options;
this.appId = appId;
this.adapter = adapter;
this.setFeature();
}

// sets features for Dashboard to consume from features router
setFeature() {}

set adapter(adapter) {
this.validateAdapter(adapter);
this[_adapter] = adapter;
Expand Down Expand Up @@ -71,4 +67,4 @@ export class AdaptableController {
}
}

export default AdaptableController;
export default AdaptableController;
1 change: 1 addition & 0 deletions src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ DatabaseController.prototype.find = function(className, query, options = {}) {
mongoWhere = {'$and': [mongoWhere, {'$or': orParts}]};
}
if (options.count) {
delete mongoOptions.limit;
return collection.count(mongoWhere, mongoOptions);
} else {
return collection.find(mongoWhere, mongoOptions)
Expand Down
7 changes: 0 additions & 7 deletions src/Controllers/PushController.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@ import PromiseRouter from '../PromiseRouter';
import rest from '../rest';
import AdaptableController from './AdaptableController';
import { PushAdapter } from '../Adapters/Push/PushAdapter';
import features from '../features';

const FEATURE_NAME = 'push';

export class PushController extends AdaptableController {

setFeature() {
features.setFeature(FEATURE_NAME, this.adapter.feature || {});
}

/**
* Check whether the deviceType parameter in qury condition is valid or not.
* @param {Object} where A query condition
Expand Down
Loading