Caseflow: Require unique url path for Organizations

Created on 10 Dec 2018  路  6Comments  路  Source: department-of-veterans-affairs/caseflow

The organizations table does not currently require the url field. During the effort to move judge team membership into the Organization model @marvokdolor-gov noted that judges would like to be able to add/remove attorneys from their teams. Because judges are admins of their judge teams, they already have the capability to do this. However, there is no easy way for them to navigate to the user management page and the URL for these pages is not all that discoverable as it currently stands (the fallback is to use the table ID which results in JudgeTeam urls being something like /organization/26/users). Making the JudgeTeam URL the same as the judge's CSS ID would make navigation to the user management page easier until we address navigating to that page in the UI.

When we create Organizations without explicitly defining the url field, we could a before_create hook to just fill this in with the ID field (unless we don't have an ID at that point in time...) or a lowercased and hyphen-joined version of the organization name.

Acceptance criteria

  • [ ] Organizations are required to have url fields before being inserted in the database
  • [ ] JudgeTeams are created with a url that matches the judge's CSS ID
  • [ ] Existing organizations updated with appropriate urls
generic-queue caseflow-queue Foxtrot 馃

All 6 comments

 before_create hook to just fill this in with the ID field (unless we don't have an ID at that point in time...)

I think (as you're surmising) this would need to be after_create but otherwise 馃憤

Sounds good to me 馃憤

Added URLs to all JudgeTeams that match their CSS IDs so @marvokdolor-gov can more easily find the user management page associated with the judge.

rails c> JudgeTeam.all.each { |team| team.update!(url: team.name.downcase) }

And the user management page for the judge team associated with the judge with CSS ID BVAAABSHIRE would be https://appeals.cf.ds.va.gov/organizations/bvaaabshire/users.

@lowellrex - I see this was done for judge teams. Should we keep this open for other BVA teams?

@lowellrex - I see this was done for judge teams. Should we keep this open for other BVA teams?

Absolutely!

SMALL.

  • [ ] Add validations
  • [ ] Add tests
  • [ ] Confirm all existing organizations have URLs that are unique.
Was this page helpful?
0 / 5 - 0 ratings