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

Ocrvs 8397 #8565

Merged
merged 11 commits into from
Feb 4, 2025
Merged

Ocrvs 8397 #8565

merged 11 commits into from
Feb 4, 2025

Conversation

makelicious
Copy link
Collaborator

@makelicious makelicious commented Feb 4, 2025

After merging, all partial form submissions will result to 400.

  • Generate validation based on dynamic event configuration from countryconfig
  • Create boilerplate tests for each action endpoint. Enforce it by failing test if action is added without updating
  • Add missing actions to tennis-club config

validation

To keep this easy to review, I suggest separate PRs for:

  • FieldValue refactoring and gather FieldType based mappers to one place on the next one
  • Backend to enforce allowedWhen conditionals
  • Proper action forms to use in fixtures (they currently share the same form for convenience)

Copy link

github-actions bot commented Feb 4, 2025

Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:

  • Changelog is read by country implementors who might not always be familiar with all technical details of OpenCRVS. Keep language high-level, user friendly and avoid technical references to internals.
  • Answer "What's new?", "Why was the change made?" and "Why should I care?" for each change.
  • If it's a breaking change, include a migration guide answering "What do I need to do to upgrade?".

@@ -21,8 +21,6 @@ module.exports = {
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 2,
'@typescript-eslint/no-non-null-assertion': 2,
'@typescript-eslint/no-unnecessary-condition': 1,
'@typescript-eslint/no-unsafe-argument': 1,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's reintroduce them when ts versions match

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For now, for each action add the same form.

/**
* Quick-and-dirty mock data generator for event actions.
*/
function mapTypeToMockValue(field: FieldConfig, i: number) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will be moved to same place with others on the next PR

input: ActionInputWithType
}

function mapTypeToZod(type: FieldConfig['type'], required?: boolean) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will be moved to same place with others on the next PR

@makelicious makelicious requested review from rikukissa, jamil314, tareq89 and Nil20 and removed request for rikukissa and jamil314 February 4, 2025 11:35
Copy link
Member

@rikukissa rikukissa left a comment

Choose a reason for hiding this comment

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

Looks great 👍

configuration: EventConfig,
action: ActionType
) => {
const actionConfig = configuration?.actions.find((a) => a.type === action)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const actionConfig = configuration?.actions.find((a) => a.type === action)
const actionConfig = configuration.actions.find((a) => a.type === action)

Comment on lines 63 to 66
await getEventConfigurationById({
token,
eventType
}),
Copy link
Member

Choose a reason for hiding this comment

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

Previously the result expectation convention in the codebase has been so that if a method starts with get.. it's implied to throw an error if said thing is not found. find.. starting ones are ones that return a null or undefined but do not throw. Let's change this to either internally throw or be a find... function

@makelicious makelicious merged commit fbb3f86 into develop Feb 4, 2025
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants