Updates
This commit is contained in:
+4
-3
@@ -16,7 +16,7 @@ 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, targetId, }) {
|
||||
var _b, _c, _d, _e;
|
||||
var _b, _c, _d, _e, _f;
|
||||
const allowedTable = allowedTables.find((tbl) => tbl.table == table);
|
||||
if (!allowedTable) {
|
||||
throw new Error(`Can't Access this table: \`${table}\``);
|
||||
@@ -51,8 +51,9 @@ function checks(_a) {
|
||||
}
|
||||
}
|
||||
if ((_e = newQuery === null || newQuery === void 0 ? void 0 : newQuery.searchQuery) === null || _e === void 0 ? void 0 : _e.join) {
|
||||
for (let i = 0; i < newQuery.searchQuery.join.length; i++) {
|
||||
const join = newQuery.searchQuery.join[i];
|
||||
const alljoins = (_f = newQuery === null || newQuery === void 0 ? void 0 : newQuery.searchQuery) === null || _f === void 0 ? void 0 : _f.join.flat();
|
||||
for (let i = 0; i < alljoins.length; i++) {
|
||||
const join = alljoins[i];
|
||||
if (!join)
|
||||
continue;
|
||||
const joinTableName = join.tableName;
|
||||
|
||||
@@ -171,6 +171,7 @@ function sqlGenerator({ tableName, genObject, dbFullName, count }) {
|
||||
str +=
|
||||
"," +
|
||||
genObject.join
|
||||
.flat()
|
||||
.filter((j) => !(0, lodash_1.isUndefined)(j))
|
||||
.map((joinObj) => {
|
||||
const joinTableName = joinObj.alias
|
||||
@@ -214,6 +215,7 @@ function sqlGenerator({ tableName, genObject, dbFullName, count }) {
|
||||
str +=
|
||||
" " +
|
||||
genObject.join
|
||||
.flat()
|
||||
.filter((j) => !(0, lodash_1.isUndefined)(j))
|
||||
.map((join) => {
|
||||
return (join.joinType +
|
||||
|
||||
Vendored
+1
-1
@@ -851,7 +851,7 @@ export type ServerQueryParam<T extends {
|
||||
addUserId?: {
|
||||
fieldName: keyof T;
|
||||
};
|
||||
join?: (ServerQueryParamsJoin<K> | undefined)[];
|
||||
join?: (ServerQueryParamsJoin<K> | ServerQueryParamsJoin<K>[] | undefined)[];
|
||||
group?: (keyof T)[];
|
||||
countSubQueries?: ServerQueryParamsCount[];
|
||||
fullTextSearch?: ServerQueryParamFullTextSearch<T>;
|
||||
|
||||
Reference in New Issue
Block a user