While migrating users from the previous service to the new one we discovered that email addresses are not unique in the previous service. This means that one user in the new service might relate to multiple users in the previous service.
This change:
- Adds a new LegacyUser model that can belong to a User. Each LegacyUser model has one old_user_id that corresponds to the user ID in the legacy service.
- Updates the user import service so that we create this association for new users
- Creates a Rake script to backfill the association for existing users
* Add shared ownership type question and page
* Add type column to the sales logs table
* Add ownership scheme field to db
Isolating this into a separate commit so it can be cherry picked for any
other sales logs work that's necessary.
* Fix tests
* fix a test
* Fix typo
* Set default time for form handler
Co-authored-by: Dushan Despotovic <dushan@madetech.com>
* Add previous, current and next forms to form handler
* Add current, previous and next sales forms to form handler
* Implement current_lettings_form, current_sales_form and store year and form type in form
* refactor lettings_forms
* Use current, previous and next forms in lettings log model
* Use current, previous and next forms in sales log model
* use current, previous and next forms in csv service
* Remove "startyear_endyear" forms from form handler
* Remove name from form initializer and add an optional start year
* refactor get_form
* update csv test, fix form initialize
* rebase fix
* Refactor form_name_from_start_year method out
* remove unused variable
* fix typo, add date tests
* rebase, fix tests
* add comment to before test block
* Change the FormHandler back to only contain the form objects
* extract name
* Add abstract log class and sales log class
Created a parent log class for sales log and lettings log. Any bits common
to both sales and lettings can live in the parent class. As the sales log
functionality is built up any commonalities with lettings log can be extracted
into the parent log class. The sales log model is set up without a json form
and instead the form is defined in code - like the setup section of the lettings
log.
* update sales logs controller
* update lettings controller specs
* update filter method name
* update organisations controller
* use lettings method
* Add deleted tests back
* lint
Co-authored-by: Kat <katrina@madetech.com>
Co-authored-by: Kat <kosiak.katrina@gmail.com>
* Replaced log CSV direct download with email
* Tidy up authorization of organisations controller
- We already have a method to authenticate the scope of the user, so we can reuse that.
* Use Rails routes instead of absolute paths for CSV download links
* Introduce base NotifyMailer to to abstract away shared Notify mail functionality
* Fix mailer spec name
* Add worker instance to PaaS manifest
* Add CSV download bucket instance name into environment
* Update tests for improved search term handling
* Fix download mailer tests
* Clarifying comments
Co-authored-by: natdeanlewissoftwire <nat.dean-lewis@softwire.com>
Co-authored-by: James Rose <james@jbpr.net>
* feat: display label columns for la and prevloc, and show codes for previous la and prevloc fields
* refactor: combine duplicate has keys
* test: add new columns
* test: add new columns post merge
* tests: update
* feat: relocate redundant methods
* Add BOMs before CSV info
* add BOM to tests
* DRYing
* remove added blank line
* add scheme and location columns to exported csv logs, remove scheme_id and location_id
* reformat
* update tests
* linting
* linting
* use delegate to simplify code
* update column names in expected csvs for tests
* update to use csv_case_log_service
* update tests
* delegate scheme_owning and scheme_managing _organisaton_names
* update tests
* update spec variable names
* feat: remove scheme_id, location_id from support users' exports as well
* fix: revert postcode change from other branch
This renames the case_log to lettings_log as everything we've written so
far has been geared towards lettings of social housing so it makes sense to
have the name describe this. This is also a precursor to adding in stuff for
sales logs (whatever shape that takes)
Co-authored-by: James Rose <james@jbpr.net>
* wip
* add missing values to factory bot and lint
* remove irrelevand methods
* dont infer housingneeds
* typo
* update method name
* Remove housingneeds_present? method
* move set housing needs fields to case log variables file
* Only set all housing needs values to 1 if there are no housingneeds
* update json form fixture
* link
* update csv test
Co-authored-by: Dushan Despotovic <dushan@madetech.com>
* Move storage classes into a dedicated module
* Move configuration classes into a dedicated module
* Refactor configuration service
* Implement configuration via env variables
* order csv attributes based on the form
* Move is inferred csv attributes next to the inferred fields
* Add is dpo, move scheme fields to back
* move checkbox answer options
* extract move_csv_attributes method
* choose year based on which case logs are downloaded
* typo
* Extract case log csv class
* Move csv class to services
* update schema
* only stock owning orgs see schemes in nav bar
* lint
* added to organisation factory and fixed tests
* removed schemes from secondary navigation bar for non stock owning orgs
* test
* lint
* remove factory la
* Change property major repairs date validation from 2 years to 10
* add voiddate_date_in_soft_range? and major_repairs_date_in_soft_range? methods
* update error messages for hard validations
* Add property_major_repairs_value_check to the form
* add void_date_value_check and fix some namings
* Update value_check hidden in check answers to depend on whether the questions is answered
* Remove a schema key
* extract constants for number of days
* change error messages wording
* update schema and csv files
* remove irrelevant fields from csv based on the user
* display yes/no instead of true/false
* display organisation and user names instead of ids
* refactor tests
* More robust date validation
* Update app/controllers/form_controller.rb
Co-authored-by: James Rose <james@jbpr.net>
Co-authored-by: James Rose <james@jbpr.net>
* Update remote schema.rb with migrations, main features for this ticket still incoming
* Add join table for organisation self-referential parent/child relationships
* Add join table for organisation self-referential parent/child relationships
* Remove organisation_la factory and add test for organisation_relationship child/parent association
* Update spec/models/organisation_spec.rb
Co-authored-by: James Rose <james@jbpr.net>
Co-authored-by: James Rose <james@jbpr.net>
* Don't crash when invalid checkbox answers are selected
* Ensure all checkbox selections are preserved not just the first that doesn't match the all
* Rubocop