@@ -76,17 +76,6 @@ defmodule Algora.Interviews do
7676 |> JobInterview . changeset ( attrs )
7777 |> Repo . insert ( ) do
7878 { :ok , interview } ->
79- # Schedule reminder emails if the interview has a scheduled time
80- # if Map.get(attrs, :scheduled_at) || Map.get(attrs, "scheduled_at") do
81- # case AlgoraCloud.Talent.Jobs.SendInterviewReminderEmail.schedule_reminders(interview.id) do
82- # {:ok, results} ->
83- # Logger.info("Scheduled interview reminders for interview #{interview.id}: #{inspect(results)}")
84-
85- # {:error, reason} ->
86- # Logger.warning("Failed to schedule interview reminders for interview #{interview.id}: #{inspect(reason)}")
87- # end
88- # end
89-
9079 { :ok , interview }
9180
9281 { :error , changeset } ->
@@ -140,73 +129,4 @@ defmodule Algora.Interviews do
140129 def change_job_interview ( % JobInterview { } = job_interview , attrs \\ % { } ) do
141130 JobInterview . changeset ( job_interview , attrs )
142131 end
143-
144- @ doc """
145- Creates a job interview with the given status.
146-
147- ## Examples
148-
149- iex> create_interview_with_status(user_id, job_posting_id, :scheduled)
150- {:ok, %JobInterview{}}
151-
152- iex> create_interview_with_status(user_id, job_posting_id, :completed, "Great candidate!")
153- {:ok, %JobInterview{}}
154-
155- """
156- def create_interview_with_status ( user_id , job_posting_id , status , notes \\ nil ) do
157- attrs = % {
158- user_id: user_id ,
159- job_posting_id: job_posting_id ,
160- status: status ,
161- notes: notes
162- }
163-
164- attrs =
165- case status do
166- :scheduled ->
167- Map . put ( attrs , :scheduled_at , DateTime . utc_now ( ) )
168-
169- :completed ->
170- attrs
171- |> Map . put ( :scheduled_at , DateTime . utc_now ( ) )
172- |> Map . put ( :completed_at , DateTime . utc_now ( ) )
173-
174- _ ->
175- attrs
176- end
177-
178- case create_job_interview ( attrs ) do
179- { :ok , interview } ->
180- # Additional scheduling logic is handled in create_job_interview
181- { :ok , interview }
182-
183- { :error , changeset } ->
184- { :error , changeset }
185- end
186- end
187-
188- @ doc """
189- Upserts a job interview for a user and job posting.
190- If an interview already exists, returns the existing one.
191- If not, creates a new one with initial status.
192-
193- ## Examples
194-
195- iex> upsert_job_interview(user_id, job_posting_id)
196- {:ok, %JobInterview{}}
197-
198- """
199- def upsert_job_interview ( user_id , job_posting_id ) do
200- case Repo . get_by ( JobInterview , user_id: user_id , job_posting_id: job_posting_id ) do
201- nil ->
202- create_job_interview ( % {
203- user_id: user_id ,
204- job_posting_id: job_posting_id ,
205- status: :initial
206- } )
207-
208- existing_interview ->
209- { :ok , existing_interview }
210- end
211- end
212132end
0 commit comments