Skip to content

Commit 3edcfec

Browse files
committed
Remove 'database' field from request and make all database requests go through config.
1 parent a0c44ce commit 3edcfec

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/Routers/UsersRouter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class UsersRouter extends ClassesRouter {
7575
}
7676

7777
let user;
78-
return req.database.find('_User', { username: req.body.username })
78+
return req.config.database.find('_User', { username: req.body.username })
7979
.then((results) => {
8080
if (!results.length) {
8181
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Invalid username/password.');

src/middlewares.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ function handleParseHeaders(req, res, next) {
8686

8787
info.app = cache.apps.get(info.appId);
8888
req.config = new Config(info.appId, mount);
89-
req.database = req.config.database;
9089
req.info = info;
9190

9291
var isMaster = (info.masterKey === req.config.masterKey);

src/testing-routes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function clearApp(req, res) {
3232
if (!req.auth.isMaster) {
3333
return res.status(401).send({"error": "unauthorized"});
3434
}
35-
req.database.deleteEverything().then(() => {
35+
return req.config.database.deleteEverything().then(() => {
3636
res.status(200).send({});
3737
});
3838
}
@@ -42,7 +42,7 @@ function dropApp(req, res) {
4242
if (!req.auth.isMaster) {
4343
return res.status(401).send({"error": "unauthorized"});
4444
}
45-
req.database.deleteEverything().then(() => {
45+
return req.config.database.deleteEverything().then(() => {
4646
cache.apps.remove(req.config.applicationId);
4747
res.status(200).send({});
4848
});

0 commit comments

Comments
 (0)