Skip to content

Commit

Permalink
Add organisations:add_programme (#3112)
Browse files Browse the repository at this point in the history
This adds a Rake task that can be used to add a programme to an existing
organisation.
  • Loading branch information
thomasleese authored Feb 28, 2025
2 parents 427ea8f + cc2a918 commit 548996b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/rake-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ This creates a new clinic location and attaches it to a organisation.

Creates a GP practice location suitable for smoke testing in production.

## Organisations

### `organisations:add_programme[ods_code,type]`

- `ods_code` - The ODS code of the organisation.
- `type` - The programme type to add to the organisation. (`hpv`, `menacwy`, `td_ipv`)

This adds a programme to an existing organisation. Normally this would be handled by the onboarding process.

## Schools

### `schools:add_to_organisation[ods_code,team_name,urn,...]`
Expand Down
11 changes: 11 additions & 0 deletions lib/tasks/organisations.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

namespace :organisations do
desc "Add a programme to an organisation."
task :add_programme, %i[ods_code type] => :environment do |_task, args|
organisation = Organisation.find_by!(ods_code: args[:ods_code])
programme = Programme.find_by!(type: args[:type])

OrganisationProgramme.find_or_create_by!(organisation:, programme:)
end
end

0 comments on commit 548996b

Please sign in to comment.