Skip to content

Commit 9e5a17d

Browse files
committed
add new job match fields
1 parent d514338 commit 9e5a17d

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

lib/algora/matches/matches.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ defmodule Algora.Matches do
1818
|> filter_by_user_id(opts[:user_id])
1919
|> filter_by_org_id(opts[:org_id])
2020
|> filter_by_status(opts[:status])
21+
|> filter_by_is_draft(opts[:include_drafts])
2122
|> join(:inner, [m], j in assoc(m, :job_posting), as: :j)
2223
|> order_by(^order_by_clause)
2324
|> maybe_preload(opts[:preload])
@@ -271,6 +272,12 @@ defmodule Algora.Matches do
271272
where(query, [m], m.status == ^status)
272273
end
273274

275+
defp filter_by_is_draft(query, true), do: query
276+
277+
defp filter_by_is_draft(query, _) do
278+
where(query, [m], m.is_draft == false)
279+
end
280+
274281
defp maybe_preload(query, nil), do: query
275282

276283
defp maybe_preload(query, preload_list) do

lib/algora/matches/schemas/job_match.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ defmodule Algora.Matches.JobMatch do
2121
field :anonymize, :boolean, default: true
2222
field :company_notes, :string
2323
field :dripped_at, :utc_datetime_usec
24+
field :locked, :boolean, default: false
25+
field :is_draft, :boolean, default: false
2426

2527
belongs_to :user, Algora.Accounts.User
2628
belongs_to :job_posting, Algora.Jobs.JobPosting
@@ -45,7 +47,9 @@ defmodule Algora.Matches.JobMatch do
4547
:custom_sort_order,
4648
:anonymize,
4749
:company_notes,
48-
:dripped_at
50+
:dripped_at,
51+
:locked,
52+
:is_draft
4953
])
5054
|> validate_required([:user_id, :job_posting_id])
5155
|> validate_inclusion(:status, [:pending, :discarded, :automatched, :dripped, :approved, :highlighted])
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
defmodule Algora.Repo.Migrations.AddLockedToJobMatches do
2+
use Ecto.Migration
3+
4+
def change do
5+
alter table(:job_matches) do
6+
add :locked, :boolean, default: false, null: false
7+
end
8+
end
9+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
defmodule Algora.Repo.Migrations.AddIsDraftToJobMatches do
2+
use Ecto.Migration
3+
4+
def change do
5+
alter table(:job_matches) do
6+
add :is_draft, :boolean, default: false, null: false
7+
end
8+
end
9+
end

0 commit comments

Comments
 (0)