Fix TS errors, remove last loader usage

This commit is contained in:
rijkvanzanten
2020-06-26 14:21:22 -04:00
parent 3f5692bef4
commit 545f9b11c4
3 changed files with 7 additions and 4 deletions

View File

@@ -5,7 +5,7 @@
"main": "dist/server.js",
"scripts": {
"start": "NODE_ENV=production node dist/server.js",
"build": "rimraf dist && tsc && copyfiles \"src/**/*.*\" -e \"src/**/*.ts\" -u 1 dist",
"build": "rimraf dist && tsc -b && copyfiles \"src/**/*.*\" -e \"src/**/*.ts\" -u 1 dist",
"dev": "LOG_LEVEL=trace ts-node-dev src/server.ts --clear --watch \"src/**/*.ts\" --rs --transpile-only | pino-colada"
},
"repository": {

View File

@@ -10,7 +10,11 @@ import APIError, { ErrorCode } from '../error';
const validateCollection: RequestHandler = asyncHandler(async (req, res, next) => {
if (!req.collection) return next();
const collectionInfo = await req.loaders.collections.load(req.collection);
const collectionInfo = await database
.select('single')
.from('directus_collections')
.where({ collection: req.collection })
.first();
if (!collectionInfo) return next();

View File

@@ -2,7 +2,7 @@
* Custom properties on the req object in express
*/
import createSystemLoaders from '../loaders';
export {};
declare global {
namespace Express {
@@ -11,7 +11,6 @@ declare global {
user?: string;
role?: string;
collection?: string;
loaders?: ReturnType<typeof createSystemLoaders>;
}
}
}