Updates
This commit is contained in:
+1
-1
@@ -3,6 +3,6 @@ export default function checks<T extends {
|
||||
[k: string]: any;
|
||||
} = {
|
||||
[k: string]: any;
|
||||
}>({ table, allowedTables, query, body, method, getMiddleware, postMiddleware, putMiddleware, deleteMiddleware, crudMiddleware, }: APIPathsCrudParams<T>): Promise<Pick<APIPathsCrudParams<T>, "query" | "body"> & {
|
||||
}>({ table, allowedTables, query, body, method, getMiddleware, postMiddleware, putMiddleware, deleteMiddleware, crudMiddleware, targetId, }: APIPathsCrudParams<T>): Promise<Pick<APIPathsCrudParams<T>, "query" | "body"> & {
|
||||
allowedTable: APIPathsParamsAllowedTable;
|
||||
}>;
|
||||
|
||||
+5
-1
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = checks;
|
||||
const lodash_1 = __importDefault(require("lodash"));
|
||||
function checks(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ table, allowedTables, query, body, method, getMiddleware, postMiddleware, putMiddleware, deleteMiddleware, crudMiddleware, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ table, allowedTables, query, body, method, getMiddleware, postMiddleware, putMiddleware, deleteMiddleware, crudMiddleware, targetId, }) {
|
||||
var _b, _c, _d, _e;
|
||||
const allowedTable = allowedTables.find((tbl) => tbl.table == table);
|
||||
if (!allowedTable) {
|
||||
@@ -85,6 +85,7 @@ function checks(_a) {
|
||||
newQuery = yield getMiddleware({
|
||||
query: newQuery || {},
|
||||
table,
|
||||
targetId,
|
||||
});
|
||||
}
|
||||
if (method !== "GET" && crudMiddleware) {
|
||||
@@ -92,6 +93,7 @@ function checks(_a) {
|
||||
body: newBody || {},
|
||||
query: newQuery || {},
|
||||
table,
|
||||
targetId,
|
||||
});
|
||||
newBody = lodash_1.default.merge(newBody, middRes);
|
||||
}
|
||||
@@ -100,6 +102,7 @@ function checks(_a) {
|
||||
body: newBody || {},
|
||||
query: newQuery || {},
|
||||
table,
|
||||
targetId,
|
||||
});
|
||||
newBody = lodash_1.default.merge(newBody, middRes);
|
||||
}
|
||||
@@ -108,6 +111,7 @@ function checks(_a) {
|
||||
body: newBody || {},
|
||||
query: newQuery || {},
|
||||
table,
|
||||
targetId,
|
||||
});
|
||||
newBody = lodash_1.default.merge(newBody, middRes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user