Skip to content

Commit

Permalink
Assign joined_at when inserting person from Stripe
Browse files Browse the repository at this point in the history
  • Loading branch information
jerodsanto committed Jun 24, 2024
1 parent b81cd93 commit 8ee0c3b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/changelog/oban_workers/membership_syncer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,21 @@ defmodule Changelog.ObanWorkers.MembershipSyncer do
email |> Person.with_email() |> Repo.one()
end

defp insert_person(%{email: email, name: name}) do
defp insert_person(%{email: email, name: name, created: created_at}) do
person =
if name do
%Person{name: name, handle: Faker.handle(name)}
else
Person.with_fake_data()
end

changeset = Person.insert_changeset(person, %{email: email, public_profile: false})
attrs = %{
email: email,
public_profile: false,
joined_at: DateTime.from_unix!(created_at)
}

changeset = Person.insert_changeset(person, attrs)

case Repo.insert(changeset) do
{:ok, person} ->
Expand Down

0 comments on commit 8ee0c3b

Please sign in to comment.