Skip to content

Commit

Permalink
Add migration to SessionError table
Browse files Browse the repository at this point in the history
There are two types of errors the candidate can encounter when using one
login. Typical 500 errors and when a user uses the wrong email address

We need to know what error the candidate gets to redirect them to the
correct page.

Prior to this change we are redirecting the candidate to wrong_email
error page even if it's a 500 error page.

Adding a error_type to the SessionError table makes it easier to
distinguish between these errors. Better than storing this information
in the session.
  • Loading branch information
CatalinVoineag committed Jan 23, 2025
1 parent a43c10b commit 5845131
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/models/session_error.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
class SessionError < ApplicationRecord
belongs_to :candidate, optional: true

enum :error_type, {
internal: 'internal',
wrong_email_address: 'wrong_email_address',
}
end
1 change: 1 addition & 0 deletions config/analytics_blocklist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- id_token_hint
- body
- omniauth_hash
- error_type
- created_at
- updated_at
:audits:
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20250123164914_add_error_type_to_session_error.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddErrorTypeToSessionError < ActiveRecord::Migration[8.0]
def change
add_column(:session_errors, :error_type, :string, default: 'internal')
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[8.0].define(version: 2025_01_09_085508) do
ActiveRecord::Schema[8.0].define(version: 2025_01_23_164914) do
create_sequence "qualifications_public_id_seq", start: 120000

# These are extensions that must be enabled in order to support this database
Expand Down Expand Up @@ -806,6 +806,7 @@
t.json "omniauth_hash"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "error_type", default: "internal"
t.index ["candidate_id"], name: "index_session_errors_on_candidate_id"
end

Expand Down
Binary file modified docs/domain-model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5845131

Please sign in to comment.