Unique indexes (#1971)

* Add unique indexing

* Add unique indexing for username/email

* WIP

* Finish unique indexes

* Notes on how to upgrade to 2.3.0 safely

* index on unique-indexes: c454180 Revert "Log objects rather than JSON stringified objects (#1922)"

* reconfigure username/email tests

* Start dealing with test shittyness

* Remove tests for files that we are removing

* most tests passing

* fix failing test

* Make specific server config for tests async

* Fix more tests

* fix more tests

* Fix another test

* fix more tests

* Fix email validation

* move some stuff around

* Destroy server to ensure all connections are gone

* Fix broken cloud code

* Save callback to variable

* no need to delete non existant cloud

* undo

* Fix all tests where connections are left open after server closes.

* Fix issues caused by missing gridstore adapter

* Update guide for 2.3.0 and fix final tests

* use strict

* don't use features that won't work in node 4

* Fix syntax error

* Fix typos

* Add duplicate finding command

* Update 2.3.0.md
This commit is contained in:
Drew
2016-06-10 20:27:21 -07:00
committed by GitHub
parent 6415a35433
commit 7e868b2dcc
37 changed files with 1727 additions and 1517 deletions

View File

@@ -1,9 +1,9 @@
import express from 'express';
import BodyParser from 'body-parser';
import * as Middlewares from '../middlewares';
import express from 'express';
import BodyParser from 'body-parser';
import * as Middlewares from '../middlewares';
import { randomHexString } from '../cryptoUtils';
import Config from '../Config';
import mime from 'mime';
import Config from '../Config';
import mime from 'mime';
export class FilesRouter {
@@ -77,8 +77,7 @@ export class FilesRouter {
res.set('Location', result.url);
res.json(result);
}).catch((err) => {
next(new Parse.Error(Parse.Error.FILE_SAVE_ERROR,
'Could not store file.'));
next(new Parse.Error(Parse.Error.FILE_SAVE_ERROR, 'Could not store file.'));
});
}
@@ -93,4 +92,4 @@ export class FilesRouter {
'Could not delete file.'));
});
}
}
}

View File

@@ -1,6 +1,5 @@
import { Parse } from 'parse/node';
import PromiseRouter from '../PromiseRouter';
import { HooksController } from '../Controllers/HooksController';
import { Parse } from 'parse/node';
import PromiseRouter from '../PromiseRouter';
import * as middleware from "../middlewares";
export class HooksRouter extends PromiseRouter {
@@ -26,7 +25,7 @@ export class HooksRouter extends PromiseRouter {
return Promise.resolve({response: foundFunction});
});
}
return hooksController.getFunctions().then((functions) => {
return { response: functions || [] };
}, (err) => {
@@ -37,7 +36,7 @@ export class HooksRouter extends PromiseRouter {
handleGetTriggers(req) {
var hooksController = req.config.hooksController;
if (req.params.className && req.params.triggerName) {
return hooksController.getTrigger(req.params.className, req.params.triggerName).then((foundTrigger) => {
if (!foundTrigger) {
throw new Parse.Error(143,`class ${req.params.className} does not exist`);
@@ -45,7 +44,7 @@ export class HooksRouter extends PromiseRouter {
return Promise.resolve({response: foundTrigger});
});
}
return hooksController.getTriggers().then((triggers) => ({ response: triggers || [] }));
}
@@ -73,10 +72,10 @@ export class HooksRouter extends PromiseRouter {
hook.url = req.body.url
} else {
throw new Parse.Error(143, "invalid hook declaration");
}
}
return this.updateHook(hook, req.config);
}
handlePut(req) {
var body = req.body;
if (body.__op == "Delete") {
@@ -85,7 +84,7 @@ export class HooksRouter extends PromiseRouter {
return this.handleUpdate(req);
}
}
mountRoutes() {
this.route('GET', '/hooks/functions', middleware.promiseEnforceMasterKeyAccess, this.handleGetFunctions.bind(this));
this.route('GET', '/hooks/triggers', middleware.promiseEnforceMasterKeyAccess, this.handleGetTriggers.bind(this));