Skip to content
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

Admin: Add community size of a partner organisation #1028

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions admin/src/collections/PartnerOrganisations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ export const buildPartnerOrganisationsCollection = () => {
properties: buildProperties<PartnerOrganisation>({
name: {
dataType: 'string',
name: 'Org Name',
},
contactName: {
dataType: 'string',
name: 'Contact Person',
},
contactNumber: {
dataType: 'string',
name: 'Contact Number',
},
communitySize: {
dataType: 'number',
name: 'Community Size',
},
Comment on lines +29 to 32
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance communitySize field configuration.

Add validation and helpful context:

  • Mark as required field
  • Add validation rules
  • Add description explaining the 10% recipient calculation
 			communitySize: {
 				dataType: 'number',
 				name: 'Community Size',
+				validation: {
+					min: 1,
+				},
+				required: true,
+				description: 'Total number of people in the community. Social Income will cover 10% of this number as recipients.',
 			},
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
communitySize: {
dataType: 'number',
name: 'Community Size',
},
communitySize: {
dataType: 'number',
name: 'Community Size',
validation: {
min: 1,
},
required: true,
description: 'Total number of people in the community. Social Income will cover 10% of this number as recipients.',
},

}),
});
Expand Down
1 change: 1 addition & 0 deletions shared/src/types/partner-organisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export type PartnerOrganisation = {
name: string;
contactName: string;
contactNumber: string;
communitySize: number;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add validation constraints for communitySize.

Since this represents the number of people in a community:

  • Negative values should be prevented
  • Consider adding a minimum value check (e.g., > 0)
-	communitySize: number;
+	communitySize: {
+		type: number;
+		minimum: 1;
+	};

Committable suggestion skipped: line range outside the PR's diff.

};
Loading