-
Notifications
You must be signed in to change notification settings - Fork 5
1069-add-immediate-onboarding #640
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
base: main
Are you sure you want to change the base?
Conversation
…mimic current behaviour
2c1ff13 to
12f5e0a
Compare
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.
Pull request overview
This pull request introduces immediate school onboarding functionality behind a feature flag ENABLE_IMMEDIATE_SCHOOL_ONBOARDING. The main changes separate the onboarding logic (role creation and Profile API registration) from the verification process, and automatically generate school codes at creation time rather than at verification time. Additionally, administrative_area and postal_code are made required fields to match frontend validation.
Changes:
- Added
SchoolOnboardingServiceto handle role creation and Profile API registration - Modified
SchoolVerificationServiceto conditionally skip onboarding when the feature flag is enabled - Updated
Schoolmodel to generate codes automatically viaafter_commitcallback when immediate onboarding is enabled - Updated
School::Createoperation to call onboarding service when feature flag is enabled - Made
administrative_areaandpostal_coderequired fields on theSchoolmodel
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
lib/feature_flags.rb |
New module defining the immediate_school_onboarding? method to check the feature flag |
app/services/school_onboarding_service.rb |
New service extracting onboarding logic (role creation, Profile API registration) |
app/services/school_verification_service.rb |
Modified to conditionally delegate to onboarding service based on feature flag |
app/models/school.rb |
Added validations for new required fields, after_commit callback for code generation, refactored verify! and generate_code! methods |
lib/concepts/school/operations/create.rb |
Added token parameter and onboarding service call within transaction |
app/controllers/api/schools_controller.rb |
Updated to pass token parameter to School::Create |
app/jobs/school_import_job.rb |
Updated to pass token parameter to School::Create |
spec/services/school_verification_service_spec.rb |
Added test coverage for both feature flag states |
spec/services/school_onboarding_service_spec.rb |
New test file for onboarding service |
spec/models/school_spec.rb |
Updated tests for new validations and code generation behavior |
spec/lib/feature_flags_spec.rb |
New test file for feature flag module |
spec/jobs/school_import_job_spec.rb |
Updated test data to include new required fields |
spec/features/school/showing_a_school_spec.rb |
Simplified test for forbidden access scenario |
spec/features/school/creating_a_school_spec.rb |
Updated test data to include new required fields |
spec/factories/school.rb |
Updated factory to generate new required fields using Faker |
spec/concepts/school/create_spec.rb |
Updated all calls to include token parameter and adjusted error count expectation |
lib/tasks/seeds_helper.rb |
Added generation of new required fields in seed helper |
.env.example |
Documented new feature flag environment variable |
…if the code fails This is really an edge case, but because of that in the unlikely case it happens we're better off erroring and fixing it. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was the result of a merge conflict, the original behaviour needs to be preserved Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…not called int he school concept depending on the feature flag
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
jamiebenstead
left a comment
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.
LGTM
Status
What's changed?
administrative_areaandpostal_codeto required fields, to match the frontendENABLE_IMMEDIATE_SCHOOL_ONBOARDINGSteps to perform after deploying to production
N/A