@loomcore/api 0.0.55 → 0.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -20,13 +20,18 @@ export class MultiTenantApiService extends GenericApiService {
|
|
|
20
20
|
return this.tenantDecorator.applyTenantToQuery(userContext, query, this.pluralResourceName);
|
|
21
21
|
}
|
|
22
22
|
prepareQueryOptions(userContext, queryOptions) {
|
|
23
|
+
console.log('--- MultiTenantApiService.prepareQueryOptions ---');
|
|
24
|
+
console.log('Initial queryOptions.filters:', JSON.stringify(queryOptions.filters, null, 2));
|
|
23
25
|
if (!config?.app?.isMultiTenant) {
|
|
24
26
|
return super.prepareQueryOptions(userContext, queryOptions);
|
|
25
27
|
}
|
|
26
28
|
if (!userContext || !userContext._orgId) {
|
|
27
29
|
throw new BadRequestError('A valid userContext was not provided to MultiTenantApiService.prepareQueryOptions');
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
const newQueryOptions = this.tenantDecorator.applyTenantToQueryOptions(userContext, queryOptions, this.pluralResourceName);
|
|
32
|
+
console.log('Final queryOptions.filters:', JSON.stringify(newQueryOptions.filters, null, 2));
|
|
33
|
+
console.log('-------------------------------------------------');
|
|
34
|
+
return newQueryOptions;
|
|
30
35
|
}
|
|
31
36
|
async prepareEntity(userContext, entity, isCreate, allowId = false) {
|
|
32
37
|
if (!config?.app?.isMultiTenant) {
|
package/dist/utils/db.utils.js
CHANGED
|
@@ -168,6 +168,9 @@ function buildMongoMatchFromQueryOptions(queryOptions, modelSpec) {
|
|
|
168
168
|
const filters = queryOptions.filters || {};
|
|
169
169
|
const schema = modelSpec?.fullSchema;
|
|
170
170
|
let match = {};
|
|
171
|
+
console.log('--- Building Mongo Match ---');
|
|
172
|
+
console.log('Received queryOptions.filters:', JSON.stringify(filters, null, 2));
|
|
173
|
+
console.log('Received modelSpec:', !!modelSpec);
|
|
171
174
|
for (const [key, value] of Object.entries(filters)) {
|
|
172
175
|
if (value) {
|
|
173
176
|
const propSchema = schema ? getPropertySchema(key, schema) : undefined;
|
|
@@ -217,6 +220,8 @@ function buildMongoMatchFromQueryOptions(queryOptions, modelSpec) {
|
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
222
|
}
|
|
223
|
+
console.log('Constructed $match object:', JSON.stringify(match, null, 2));
|
|
224
|
+
console.log('--------------------------');
|
|
220
225
|
return { $match: match };
|
|
221
226
|
}
|
|
222
227
|
function buildSQLWhereClauseFromQueryOptions(queryOptions, columnAliasMap) {
|