Skip to content

Commit 2c26e86

Browse files
authored
Merge pull request #6541 from NHSDigital/add-careplus-url-credentials
Add columns for careplus namespace, username and password to team model
2 parents 4ba0f43 + 4c74779 commit 2c26e86

7 files changed

Lines changed: 35 additions & 1 deletion

File tree

app/models/onboarding.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ class Onboarding
2424

2525
TEAM_ATTRIBUTES = {
2626
point_of_care: %i[
27+
careplus_namespace
28+
careplus_password
2729
careplus_staff_code
2830
careplus_staff_type
31+
careplus_username
2932
careplus_venue_code
3033
days_before_consent_reminders
3134
days_before_consent_requests

app/models/team.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
# Table name: teams
66
#
77
# id :bigint not null, primary key
8+
# careplus_namespace :string
9+
# careplus_password :string
810
# careplus_staff_code :string
911
# careplus_staff_type :string
12+
# careplus_username :string
1013
# careplus_venue_code :string
1114
# days_before_consent_reminders :integer default(7), not null
1215
# days_before_consent_requests :integer default(21), not null
@@ -80,6 +83,8 @@ class Team < ApplicationRecord
8083
normalizes :email, with: EmailAddressNormaliser.new
8184
normalizes :phone, with: PhoneNumberNormaliser.new
8285

86+
encrypts :careplus_username, :careplus_password
87+
8388
enum :type,
8489
{ point_of_care: 0, national_reporting: 1, support: 2 },
8590
validate: true,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
3+
class AddCareplusCredentialsToTeams < ActiveRecord::Migration[8.1]
4+
def change
5+
change_table :teams, bulk: true do |t|
6+
t.string :careplus_namespace
7+
t.string :careplus_username
8+
t.string :careplus_password
9+
end
10+
end
11+
end

db/schema.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.1].define(version: 2026_04_07_120000) do
13+
ActiveRecord::Schema[8.1].define(version: 2026_04_07_121005) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_catalog.plpgsql"
1616
enable_extension "pg_trgm"
@@ -904,8 +904,11 @@
904904
end
905905

906906
create_table "teams", force: :cascade do |t|
907+
t.string "careplus_namespace"
908+
t.string "careplus_password"
907909
t.string "careplus_staff_code"
908910
t.string "careplus_staff_type"
911+
t.string "careplus_username"
909912
t.string "careplus_venue_code"
910913
t.datetime "created_at", null: false
911914
t.integer "days_before_consent_reminders", default: 7, null: false

docs/managing-teams.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ team:
2222
careplus_staff_code: # Staff code used in CarePlus exports
2323
careplus_staff_type: # Staff type used in CarePlus exports
2424
careplus_venue_code: # Venue code used in CarePlus exports
25+
careplus_namespace: # Optional namespace for the CarePlus web service
26+
careplus_username: # Optional username for the CarePlus web service
27+
careplus_password: # Optional password for the CarePlus web service
2528
privacy_notice_url: # URL of a privacy notice shown to parents
2629
privacy_policy_url: # URL of a privacy policy shown to parents
2730
reply_to_id: # Optional GOV.UK Notify Reply-To UUID

spec/factories/teams.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
# Table name: teams
66
#
77
# id :bigint not null, primary key
8+
# careplus_namespace :string
9+
# careplus_password :string
810
# careplus_staff_code :string
911
# careplus_staff_type :string
12+
# careplus_username :string
1013
# careplus_venue_code :string
1114
# days_before_consent_reminders :integer default(7), not null
1215
# days_before_consent_requests :integer default(21), not null
@@ -90,9 +93,12 @@
9093
end
9194

9295
trait :with_careplus_enabled do
96+
careplus_namespace { "MOCK" }
9397
careplus_staff_code { "LW5PM" }
9498
careplus_staff_type { "IN" }
9599
careplus_venue_code { identifier.to_s }
100+
careplus_username { "careplus_user" }
101+
careplus_password { "careplus_password" }
96102
end
97103

98104
after(:create) do |team|

spec/models/team_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
# Table name: teams
66
#
77
# id :bigint not null, primary key
8+
# careplus_namespace :string
9+
# careplus_password :string
810
# careplus_staff_code :string
911
# careplus_staff_type :string
12+
# careplus_username :string
1013
# careplus_venue_code :string
1114
# days_before_consent_reminders :integer default(7), not null
1215
# days_before_consent_requests :integer default(21), not null

0 commit comments

Comments
 (0)