Update Types and SQL generator function
This commit is contained in:
parent
d4e210abdb
commit
ee35543885
@ -105,10 +105,17 @@ function sqlGenerator({ tableName, genObject }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (genObject.join) {
|
if (genObject.join) {
|
||||||
|
/** @type {string[]} */
|
||||||
|
const existingJoinTableNames = [tableName];
|
||||||
|
|
||||||
str +=
|
str +=
|
||||||
"," +
|
"," +
|
||||||
genObject.join
|
genObject.join
|
||||||
.map((joinObj) => {
|
.map((joinObj) => {
|
||||||
|
if (existingJoinTableNames.includes(joinObj.tableName))
|
||||||
|
return null;
|
||||||
|
existingJoinTableNames.push(joinObj.tableName);
|
||||||
|
|
||||||
if (joinObj.selectFields) {
|
if (joinObj.selectFields) {
|
||||||
return joinObj.selectFields
|
return joinObj.selectFields
|
||||||
.map((slFld) => {
|
.map((slFld) => {
|
||||||
@ -126,6 +133,7 @@ function sqlGenerator({ tableName, genObject }) {
|
|||||||
return `${joinObj.tableName}.*`;
|
return `${joinObj.tableName}.*`;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.filter((_) => Boolean(_))
|
||||||
.join(",");
|
.join(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
package-shared/types/index.d.ts
vendored
2
package-shared/types/index.d.ts
vendored
@ -1172,7 +1172,7 @@ export type FetchDataParams = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type AuthFetchQuery = ServerQueryParam & {
|
export type AuthFetchQuery = ServerQueryParam & {
|
||||||
[key: string]: string | number | { [key: string]: any };
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ServerQueryParamsJoin<
|
export type ServerQueryParamsJoin<
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "2.6.3",
|
"version": "2.6.4",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user