EpochtalkServer.Models.Notification (epochtalk_server v0.1.0)

Notification model, for performing actions relating to forum categories

Link to this section Summary

Functions

Create generic changeset for Notification model

Returns Notification counts for a specific User by id, from the database. Used to display new message/mention notifications.

Dismisses specific Notification by id. Used to display clear a specific message/mention Notification.

Dismisses Notification counts for a specific User by id. Used to display clear message/mention notifications.

Link to this section Types

@type t() :: %EpochtalkServer.Models.Notification{
  __meta__: term(),
  created_at: NaiveDateTime.t() | nil,
  data: map() | nil,
  id: non_neg_integer() | nil,
  receiver: term(),
  receiver_id: non_neg_integer() | nil,
  sender: term(),
  sender_id: non_neg_integer() | nil,
  type: String.t() | nil,
  viewed: boolean() | nil
}

Link to this section Functions

Link to this function

changeset(notification, attrs)

@spec changeset(notification :: t(), attrs :: map() | nil) :: Ecto.Changeset.t()

Create generic changeset for Notification model

Link to this function

counts_by_user_id(user_id, list)

@spec counts_by_user_id(user_id :: non_neg_integer(), [{:max, non_neg_integer()}]) ::
  map()

Returns Notification counts for a specific User by id, from the database. Used to display new message/mention notifications.

@spec dismiss(id :: integer()) :: {non_neg_integer(), nil | [term()]}

Dismisses specific Notification by id. Used to display clear a specific message/mention Notification.

Link to this function

dismiss_type_by_user_id(user_id, type)

@spec dismiss_type_by_user_id(user_id :: integer(), type :: String.t()) ::
  {non_neg_integer(), nil | [term()]} | {:error, :invalid_notification_type}

Dismisses Notification counts for a specific User by id. Used to display clear message/mention notifications.