Skip to content

Commit

Permalink
Merge pull request #111 from souravbhowmik1999/issue_fix_new
Browse files Browse the repository at this point in the history
search field api changes
  • Loading branch information
Sourav-Tekdi authored Dec 9, 2024
2 parents 9275b6b + 56aa04f commit eb1e2a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/adapters/postgres/fields-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,8 @@ export class PostgresFieldsService implements IServicelocatorfields {
const fieldKeys = this.fieldsRepository.metadata.columns.map(
(column) => column.propertyName
);
let whereClause = `"tenantId" = '${tenantId}'`;
let tenantCond = tenantId? `"tenantId" = ${tenantId}` :`"tenantId" IS NULL`
let whereClause = tenantCond;
if (filters && Object.keys(filters).length > 0) {
Object.entries(filters).forEach(([key, value]) => {
if (fieldKeys.includes(key)) {
Expand All @@ -813,6 +814,7 @@ export class PostgresFieldsService implements IServicelocatorfields {
}
});
}

const fieldData = await this.getFieldData(whereClause);
if (!fieldData.length) {
return APIResponse.error(
Expand Down

0 comments on commit eb1e2a0

Please sign in to comment.