Skip to content

Commit ec95b58

Browse files
committed
add field for custom sorting
1 parent ce9ed98 commit ec95b58

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

lib/algora/matches/schemas/job_match.ex

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ defmodule Algora.Matches.JobMatch do
1414
field :candidate_approved_at, :utc_datetime_usec
1515
field :candidate_bookmarked_at, :utc_datetime_usec
1616
field :candidate_discarded_at, :utc_datetime_usec
17+
field :custom_sort_order, :integer
1718

1819
belongs_to :user, Algora.Accounts.User
1920
belongs_to :job_posting, Algora.Jobs.JobPosting
@@ -23,7 +24,20 @@ defmodule Algora.Matches.JobMatch do
2324

2425
def changeset(job_match, attrs) do
2526
job_match
26-
|> cast(attrs, [:user_id, :job_posting_id, :status, :score, :notes, :company_approved_at, :company_bookmarked_at, :company_discarded_at, :candidate_approved_at, :candidate_bookmarked_at, :candidate_discarded_at])
27+
|> cast(attrs, [
28+
:user_id,
29+
:job_posting_id,
30+
:status,
31+
:score,
32+
:notes,
33+
:company_approved_at,
34+
:company_bookmarked_at,
35+
:company_discarded_at,
36+
:candidate_approved_at,
37+
:candidate_bookmarked_at,
38+
:candidate_discarded_at,
39+
:custom_sort_order
40+
])
2741
|> validate_required([:user_id, :job_posting_id])
2842
|> validate_inclusion(:status, [:pending, :discarded, :approved, :highlighted])
2943
|> foreign_key_constraint(:user_id)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
defmodule Algora.Repo.Migrations.AddCustomSortingToJobMatches do
2+
use Ecto.Migration
3+
4+
def change do
5+
alter table(:job_matches) do
6+
add :custom_sort_order, :integer
7+
end
8+
9+
create index(:job_matches, [:custom_sort_order])
10+
end
11+
end

0 commit comments

Comments
 (0)