mirror of
https://github.com/directus/directus.git
synced 2026-02-02 01:25:00 -05:00
Fix TS errors, remove last loader usage
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
3
src/types/express.d.ts
vendored
3
src/types/express.d.ts
vendored
@@ -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>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user