diff --git a/dist/package-shared/functions/web-app/db/grab-user-resource/index.d.ts b/dist/package-shared/functions/web-app/db/grab-user-resource/index.d.ts index d9c9e30..575f541 100644 --- a/dist/package-shared/functions/web-app/db/grab-user-resource/index.d.ts +++ b/dist/package-shared/functions/web-app/db/grab-user-resource/index.d.ts @@ -5,10 +5,7 @@ export default function dbGrabUserResource = { success: boolean; payload?: T; @@ -1411,10 +1415,8 @@ export type APIResponseObject = { payloadThumbnailURL?: string; error?: any; msg?: string; - queryObject?: { - sql?: string; - params?: string[]; - }; + queryObject?: ResponseQueryObject; + countQueryObject?: ResponseQueryObject; status?: number; count?: number; errors?: DSQLErrorObject[]; diff --git a/dist/package-shared/utils/data-fetching/crud-get.js b/dist/package-shared/utils/data-fetching/crud-get.js index 3d20d1f..2bb3149 100644 --- a/dist/package-shared/utils/data-fetching/crud-get.js +++ b/dist/package-shared/utils/data-fetching/crud-get.js @@ -40,7 +40,7 @@ function default_1(_a) { dbFullName, }) : undefined; - if (count && countQueryObject) { + if ((count || countOnly) && countQueryObject) { connQueries.push({ query: countQueryObject.string, values: countQueryObject.values, @@ -81,12 +81,16 @@ function default_1(_a) { sql: queryObject === null || queryObject === void 0 ? void 0 : queryObject.string, params: queryObject === null || queryObject === void 0 ? void 0 : queryObject.values, }, + countQueryObject: { + sql: countQueryObject === null || countQueryObject === void 0 ? void 0 : countQueryObject.string, + params: countQueryObject === null || countQueryObject === void 0 ? void 0 : countQueryObject.values, + }, count: isSuccess ? ((_c = (_b = res[1]) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c["COUNT(*)"]) ? res[1][0]["COUNT(*)"] : ((_e = (_d = res[0]) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e["COUNT(*)"]) ? res[0][0]["COUNT(*)"] - : undefined + : 0 : undefined, }; }); diff --git a/package-shared/shell/createDbFromSchema/grab-required-database-schemas.ts b/package-shared/shell/createDbFromSchema/grab-required-database-schemas.ts index 24a5cdb..1ea7419 100644 --- a/package-shared/shell/createDbFromSchema/grab-required-database-schemas.ts +++ b/package-shared/shell/createDbFromSchema/grab-required-database-schemas.ts @@ -129,8 +129,9 @@ export function grabPrimaryRequiredDbSchema({ userId, dbId, dbSlug }: Params) { // } // } - console.log(`userSchemaDir not found!`); + console.log(`Coudln't grab Required DB Schema!`); console.log(`userId`, userId); + console.log(`dbId`, dbId); return undefined; } diff --git a/package-shared/types/index.ts b/package-shared/types/index.ts index 44a74ad..c3fc9dc 100644 --- a/package-shared/types/index.ts +++ b/package-shared/types/index.ts @@ -1633,6 +1633,11 @@ export type PagePropsType = { docsPageEditURL?: string | null; }; +export type ResponseQueryObject = { + sql?: string; + params?: string[]; +}; + export type APIResponseObject = { success: boolean; payload?: T; @@ -1642,10 +1647,8 @@ export type APIResponseObject = { payloadThumbnailURL?: string; error?: any; msg?: string; - queryObject?: { - sql?: string; - params?: string[]; - }; + queryObject?: ResponseQueryObject; + countQueryObject?: ResponseQueryObject; status?: number; count?: number; errors?: DSQLErrorObject[]; diff --git a/package-shared/utils/data-fetching/crud-get.ts b/package-shared/utils/data-fetching/crud-get.ts index 66529da..432d10e 100644 --- a/package-shared/utils/data-fetching/crud-get.ts +++ b/package-shared/utils/data-fetching/crud-get.ts @@ -44,7 +44,7 @@ export default async function < }) : undefined; - if (count && countQueryObject) { + if ((count || countOnly) && countQueryObject) { connQueries.push({ query: countQueryObject.string, values: countQueryObject.values, @@ -88,12 +88,16 @@ export default async function < sql: queryObject?.string, params: queryObject?.values, }, + countQueryObject: { + sql: countQueryObject?.string, + params: countQueryObject?.values, + }, count: isSuccess ? res[1]?.[0]?.["COUNT(*)"] ? res[1][0]["COUNT(*)"] : res[0]?.[0]?.["COUNT(*)"] ? res[0][0]["COUNT(*)"] - : undefined + : 0 : undefined, }; } diff --git a/package.json b/package.json index 9b15d12..4886a19 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/datasquirel", - "version": "5.4.1", + "version": "5.4.2", "description": "Cloud-based SQL data management tool", "main": "dist/index.js", "bin": {