Skip to content

Commit

Permalink
Merge pull request #169 from Shubham4026/sdbv_field_changes
Browse files Browse the repository at this point in the history
Added Field Attribute check in Validate Custom field
  • Loading branch information
Shubham4026 authored Feb 27, 2025
2 parents f54c1a3 + 26a6b69 commit c5f142b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/adapters/postgres/user-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1716,6 +1716,8 @@ export class PostgresUserService implements IServicelocator {
}

public async validateCustomField(userCreateDto, response, apiId) {
// Taking Consideration of One tenant id
const tenantId = userCreateDto.tenantCohortRoleMapping[0]?.tenantId;
const fieldValues = userCreateDto ? userCreateDto.customFields : [];
const encounteredKeys = [];
const invalidateFields = [];
Expand All @@ -1736,6 +1738,8 @@ export class PostgresUserService implements IServicelocator {
} else {
encounteredKeys.push(fieldId);
}
const fieldAttributes = getFieldDetails?.fieldAttributes || {};
getFieldDetails["fieldAttributes"] = fieldAttributes[tenantId] || fieldAttributes["general"];
if (
(getFieldDetails.type == "checkbox" ||
getFieldDetails.type == "drop_down" ||
Expand Down Expand Up @@ -1770,17 +1774,14 @@ export class PostgresUserService implements IServicelocator {
}),
};


getFieldDetails["fieldParams"] = transformedFieldParams;

// getFieldDetails['fieldParams'] = getOption
} else {
getFieldDetails["fieldParams"] = getFieldDetails?.fieldParams || {};
}

const checkValidation = this.fieldsService.validateFieldValue(
getFieldDetails,
fieldsData["value"]
fieldsData["value"]
);

if (typeof checkValidation === "object" && "error" in checkValidation) {
Expand Down

0 comments on commit c5f142b

Please sign in to comment.