-
Notifications
You must be signed in to change notification settings - Fork 45
Custom FieldName Patching #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,7 +280,8 @@ public class BeneficiaryModel implements Comparable<BeneficiaryModel> { | |
private String monthlyFamilyIncome; | ||
@Expose | ||
private boolean emergencyRegistration; | ||
|
||
@Expose | ||
private String communityName; | ||
Comment on lines
+283
to
+284
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Add validation constraints and documentation for the new communityName field While the field addition follows the class's pattern, consider the following improvements:
@Expose
+@Size(max = 50)
+@Pattern(regexp = "^[a-zA-Z0-9\\s-]*$", message = "Community name contains invalid characters")
private String communityName;
+/**
+ * Represents the beneficiary's community/ethnicity information.
+ * This field should be handled with appropriate privacy considerations.
+ */
@Expose
private String communityName;
|
||
@Expose | ||
private Boolean passToNurse = false; | ||
private String otherFields; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,7 @@ public interface SectionAndFieldsMappingRepo extends CrudRepository<SectionAndFi | |
// List<SectionAndFieldsMapping> findBySectionIdAndSectionNameAndServiceProviderId( | ||
// @Param("sectionId") Integer sectionId, @Param("serviceProviderId") Integer serviceProviderId); | ||
|
||
|
||
@Query("SELECT sfm FROM SectionAndFieldsMapping sfm WHERE sfm.fieldName = :fieldName AND (sfm.serviceProviderId = :serviceProviderId OR sfm.serviceProviderId = 0) AND (sfm.projectId = :projectId OR sfm.projectId = 0)") | ||
@Query("SELECT sfm FROM SectionAndFieldsMapping sfm WHERE sfm.sectionId = :sectionId AND (sfm.serviceProviderId = :serviceProviderId OR sfm.serviceProviderId= 0) AND (sfm.projectId = :projectId OR sfm.projectId= 0)") | ||
List<SectionAndFieldsMapping> findSectionIdAndSectionNameAndServiceProviderId( | ||
@Param("sectionId") Integer sectionId, @Param("serviceProviderId") Integer serviceProviderId, @Param("projectId") Integer projectId); | ||
Comment on lines
+19
to
21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method naming and implementation concerns need attention Several issues need to be addressed in the new query method:
Consider applying these changes: -@Query("SELECT sfm FROM SectionAndFieldsMapping sfm WHERE sfm.sectionId = :sectionId AND (sfm.serviceProviderId = :serviceProviderId OR sfm.serviceProviderId= 0) AND (sfm.projectId = :projectId OR sfm.projectId= 0)")
-List<SectionAndFieldsMapping> findSectionIdAndSectionNameAndServiceProviderId(
+@Query("SELECT sfm FROM SectionAndFieldsMapping sfm WHERE sfm.sectionId = :sectionId " +
+ "AND (sfm.serviceProviderId = :serviceProviderId OR sfm.serviceProviderId = 0) " +
+ "AND (sfm.projectId = :projectId OR sfm.projectId = 0) " +
+ "AND sfm.deleted = false")
+List<SectionAndFieldsMapping> findBySectionIdAndServiceProviderIdAndProjectId(
@Param("sectionId") Integer sectionId,
@Param("serviceProviderId") Integer serviceProviderId,
@Param("projectId") Integer projectId); Consider adding documentation to explain:
/**
* Finds section and fields mappings based on section ID, service provider ID, and project ID.
*
* @param sectionId The ID of the section to filter by
* @param serviceProviderId The service provider ID (0 represents a special case that matches all providers)
* @param projectId The project ID (0 represents a special case that matches all projects)
* @return List of matching section and fields mappings, excluding soft-deleted records
*/ |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π‘ Codebase verification
Inconsistent naming of community field across DTOs needs standardization
The codebase shows mixed usage of both
community
andcommunityName
fields:community
is used in 8 DTOs/models including BeneficiariesDTOcommunityName
is used in 3 models including BeneficiaryModelThis inconsistency should be addressed by standardizing on one naming convention across all DTOs and models. Notably,
IdentityEditDTO
has both fields which indicates potential duplication.π Analysis chain
Consider standardizing community field implementation.
While the addition of the
community
field is appropriate, consider these improvements:communityName
)Example improvement:
+ /** Community/social group of the beneficiary */ private String community;
Let's verify the naming consistency across DTOs:
π Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1191