View Source Glific.Mails.MailLog (Glific v5.1.6)

The mail log object

Link to this section Summary

Functions

Standard changeset pattern we use for all data types

Return the count of mail_logs, using the same filter as list_mail_logs

Create a Mail Log

Returns the list of mail logs. Since this is very basic and only listing functionality we added the status filter like this. In future we will put the status as virtual filed in the mail logs itself.

Check if we have sent the mail in given time

Update a Mail Log

Link to this section Types

@type t() :: %Glific.Mails.MailLog{
  __meta__: Ecto.Schema.Metadata.t(),
  category: String.t() | nil,
  content: map() | nil,
  error: term(),
  id: non_neg_integer() | nil,
  inserted_at: :utc_datetime | nil,
  organization:
    Glific.Partners.Organization.t() | Ecto.Association.NotLoaded.t() | nil,
  organization_id: non_neg_integer() | nil,
  status: String.t() | nil,
  updated_at: :utc_datetime | nil
}

Link to this section Functions

Link to this function

changeset(mail_log, attrs)

View Source
@spec changeset(t(), map()) :: Ecto.Changeset.t()

Standard changeset pattern we use for all data types

@spec count_mail_logs(map()) :: integer()

Return the count of mail_logs, using the same filter as list_mail_logs

Link to this function

create_mail_log(attrs \\ %{})

View Source
@spec create_mail_log(map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}

Create a Mail Log

@spec list_mail_logs(map()) :: list()

Returns the list of mail logs. Since this is very basic and only listing functionality we added the status filter like this. In future we will put the status as virtual filed in the mail logs itself.

Link to this function

mail_sent_in_past_time?(category, time, organization_id)

View Source
@spec mail_sent_in_past_time?(String.t(), DateTime.t(), non_neg_integer()) ::
  boolean()

Check if we have sent the mail in given time

Link to this function

update_mail_log(log, attrs)

View Source
@spec update_mail_log(t(), map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}

Update a Mail Log