mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
split users context
This commit is contained in:
parent
e76c3cdcba
commit
abd4de0b4d
20 changed files with 1015 additions and 595 deletions
104
lib/philomena/user_fingerprints.ex
Normal file
104
lib/philomena/user_fingerprints.ex
Normal file
|
@ -0,0 +1,104 @@
|
|||
defmodule Philomena.UserFingerprints do
|
||||
@moduledoc """
|
||||
The UserFingerprints context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias Philomena.Repo
|
||||
|
||||
alias Philomena.UserFingerprints.UserFingerprint
|
||||
|
||||
@doc """
|
||||
Returns the list of user_fingerprints.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_fingerprints()
|
||||
[%UserFingerprint{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_fingerprints do
|
||||
Repo.all(UserFingerprint)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single user_fingerprint.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the User fingerprint does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_user_fingerprint!(123)
|
||||
%UserFingerprint{}
|
||||
|
||||
iex> get_user_fingerprint!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_user_fingerprint!(id), do: Repo.get!(UserFingerprint, id)
|
||||
|
||||
@doc """
|
||||
Creates a user_fingerprint.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_user_fingerprint(%{field: value})
|
||||
{:ok, %UserFingerprint{}}
|
||||
|
||||
iex> create_user_fingerprint(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_user_fingerprint(attrs \\ %{}) do
|
||||
%UserFingerprint{}
|
||||
|> UserFingerprint.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a user_fingerprint.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_user_fingerprint(user_fingerprint, %{field: new_value})
|
||||
{:ok, %UserFingerprint{}}
|
||||
|
||||
iex> update_user_fingerprint(user_fingerprint, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_user_fingerprint(%UserFingerprint{} = user_fingerprint, attrs) do
|
||||
user_fingerprint
|
||||
|> UserFingerprint.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a UserFingerprint.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_user_fingerprint(user_fingerprint)
|
||||
{:ok, %UserFingerprint{}}
|
||||
|
||||
iex> delete_user_fingerprint(user_fingerprint)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_user_fingerprint(%UserFingerprint{} = user_fingerprint) do
|
||||
Repo.delete(user_fingerprint)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking user_fingerprint changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_user_fingerprint(user_fingerprint)
|
||||
%Ecto.Changeset{source: %UserFingerprint{}}
|
||||
|
||||
"""
|
||||
def change_user_fingerprint(%UserFingerprint{} = user_fingerprint) do
|
||||
UserFingerprint.changeset(user_fingerprint, %{})
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Philomena.Users.Fingerprint do
|
||||
defmodule Philomena.UserFingerprints.UserFingerprint do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
|
@ -12,8 +12,8 @@ defmodule Philomena.Users.Fingerprint do
|
|||
end
|
||||
|
||||
@doc false
|
||||
def changeset(fingerprints, attrs) do
|
||||
fingerprints
|
||||
def changeset(user_fingerprint, attrs) do
|
||||
user_fingerprint
|
||||
|> cast(attrs, [])
|
||||
|> validate_required([])
|
||||
end
|
104
lib/philomena/user_ips.ex
Normal file
104
lib/philomena/user_ips.ex
Normal file
|
@ -0,0 +1,104 @@
|
|||
defmodule Philomena.UserIps do
|
||||
@moduledoc """
|
||||
The UserIps context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias Philomena.Repo
|
||||
|
||||
alias Philomena.UserIps.UserIp
|
||||
|
||||
@doc """
|
||||
Returns the list of user_ips.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_ips()
|
||||
[%UserIp{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_ips do
|
||||
Repo.all(UserIp)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single user_ip.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the User ip does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_user_ip!(123)
|
||||
%UserIp{}
|
||||
|
||||
iex> get_user_ip!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_user_ip!(id), do: Repo.get!(UserIp, id)
|
||||
|
||||
@doc """
|
||||
Creates a user_ip.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_user_ip(%{field: value})
|
||||
{:ok, %UserIp{}}
|
||||
|
||||
iex> create_user_ip(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_user_ip(attrs \\ %{}) do
|
||||
%UserIp{}
|
||||
|> UserIp.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a user_ip.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_user_ip(user_ip, %{field: new_value})
|
||||
{:ok, %UserIp{}}
|
||||
|
||||
iex> update_user_ip(user_ip, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_user_ip(%UserIp{} = user_ip, attrs) do
|
||||
user_ip
|
||||
|> UserIp.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a UserIp.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_user_ip(user_ip)
|
||||
{:ok, %UserIp{}}
|
||||
|
||||
iex> delete_user_ip(user_ip)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_user_ip(%UserIp{} = user_ip) do
|
||||
Repo.delete(user_ip)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking user_ip changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_user_ip(user_ip)
|
||||
%Ecto.Changeset{source: %UserIp{}}
|
||||
|
||||
"""
|
||||
def change_user_ip(%UserIp{} = user_ip) do
|
||||
UserIp.changeset(user_ip, %{})
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Philomena.Users.Ip do
|
||||
defmodule Philomena.UserIps.UserIp do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
|
@ -12,8 +12,8 @@ defmodule Philomena.Users.Ip do
|
|||
end
|
||||
|
||||
@doc false
|
||||
def changeset(ip, attrs) do
|
||||
ip
|
||||
def changeset(user_ip, attrs) do
|
||||
user_ip
|
||||
|> cast(attrs, [])
|
||||
|> validate_required([])
|
||||
end
|
104
lib/philomena/user_links.ex
Normal file
104
lib/philomena/user_links.ex
Normal file
|
@ -0,0 +1,104 @@
|
|||
defmodule Philomena.UserLinks do
|
||||
@moduledoc """
|
||||
The UserLinks context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias Philomena.Repo
|
||||
|
||||
alias Philomena.UserLinks.UserLink
|
||||
|
||||
@doc """
|
||||
Returns the list of user_links.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_links()
|
||||
[%UserLink{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_links do
|
||||
Repo.all(UserLink)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single user_link.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the User link does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_user_link!(123)
|
||||
%UserLink{}
|
||||
|
||||
iex> get_user_link!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_user_link!(id), do: Repo.get!(UserLink, id)
|
||||
|
||||
@doc """
|
||||
Creates a user_link.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_user_link(%{field: value})
|
||||
{:ok, %UserLink{}}
|
||||
|
||||
iex> create_user_link(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_user_link(attrs \\ %{}) do
|
||||
%UserLink{}
|
||||
|> UserLink.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a user_link.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_user_link(user_link, %{field: new_value})
|
||||
{:ok, %UserLink{}}
|
||||
|
||||
iex> update_user_link(user_link, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_user_link(%UserLink{} = user_link, attrs) do
|
||||
user_link
|
||||
|> UserLink.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a UserLink.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_user_link(user_link)
|
||||
{:ok, %UserLink{}}
|
||||
|
||||
iex> delete_user_link(user_link)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_user_link(%UserLink{} = user_link) do
|
||||
Repo.delete(user_link)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking user_link changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_user_link(user_link)
|
||||
%Ecto.Changeset{source: %UserLink{}}
|
||||
|
||||
"""
|
||||
def change_user_link(%UserLink{} = user_link) do
|
||||
UserLink.changeset(user_link, %{})
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Philomena.Users.Link do
|
||||
defmodule Philomena.UserLinks.UserLink do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
|
@ -21,8 +21,8 @@ defmodule Philomena.Users.Link do
|
|||
end
|
||||
|
||||
@doc false
|
||||
def changeset(link, attrs) do
|
||||
link
|
||||
def changeset(user_link, attrs) do
|
||||
user_link
|
||||
|> cast(attrs, [])
|
||||
|> validate_required([])
|
||||
end
|
104
lib/philomena/user_name_changes.ex
Normal file
104
lib/philomena/user_name_changes.ex
Normal file
|
@ -0,0 +1,104 @@
|
|||
defmodule Philomena.UserNameChanges do
|
||||
@moduledoc """
|
||||
The UserNameChanges context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias Philomena.Repo
|
||||
|
||||
alias Philomena.UserNameChanges.UserNameChange
|
||||
|
||||
@doc """
|
||||
Returns the list of user_name_changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_name_changes()
|
||||
[%UserNameChange{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_name_changes do
|
||||
Repo.all(UserNameChange)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single user_name_change.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the User name change does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_user_name_change!(123)
|
||||
%UserNameChange{}
|
||||
|
||||
iex> get_user_name_change!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_user_name_change!(id), do: Repo.get!(UserNameChange, id)
|
||||
|
||||
@doc """
|
||||
Creates a user_name_change.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_user_name_change(%{field: value})
|
||||
{:ok, %UserNameChange{}}
|
||||
|
||||
iex> create_user_name_change(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_user_name_change(attrs \\ %{}) do
|
||||
%UserNameChange{}
|
||||
|> UserNameChange.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a user_name_change.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_user_name_change(user_name_change, %{field: new_value})
|
||||
{:ok, %UserNameChange{}}
|
||||
|
||||
iex> update_user_name_change(user_name_change, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_user_name_change(%UserNameChange{} = user_name_change, attrs) do
|
||||
user_name_change
|
||||
|> UserNameChange.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a UserNameChange.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_user_name_change(user_name_change)
|
||||
{:ok, %UserNameChange{}}
|
||||
|
||||
iex> delete_user_name_change(user_name_change)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_user_name_change(%UserNameChange{} = user_name_change) do
|
||||
Repo.delete(user_name_change)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking user_name_change changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_user_name_change(user_name_change)
|
||||
%Ecto.Changeset{source: %UserNameChange{}}
|
||||
|
||||
"""
|
||||
def change_user_name_change(%UserNameChange{} = user_name_change) do
|
||||
UserNameChange.changeset(user_name_change, %{})
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Philomena.Users.NameChange do
|
||||
defmodule Philomena.UserNameChanges.UserNameChange do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
|
@ -10,8 +10,8 @@ defmodule Philomena.Users.NameChange do
|
|||
end
|
||||
|
||||
@doc false
|
||||
def changeset(name_change, attrs) do
|
||||
name_change
|
||||
def changeset(user_name_change, attrs) do
|
||||
user_name_change
|
||||
|> cast(attrs, [])
|
||||
|> validate_required([])
|
||||
end
|
104
lib/philomena/user_statistics.ex
Normal file
104
lib/philomena/user_statistics.ex
Normal file
|
@ -0,0 +1,104 @@
|
|||
defmodule Philomena.UserStatistics do
|
||||
@moduledoc """
|
||||
The UserStatistics context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias Philomena.Repo
|
||||
|
||||
alias Philomena.UserStatistics.UserStatistic
|
||||
|
||||
@doc """
|
||||
Returns the list of user_statistics.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_statistics()
|
||||
[%UserStatistic{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_statistics do
|
||||
Repo.all(UserStatistic)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single user_statistic.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the User statistic does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_user_statistic!(123)
|
||||
%UserStatistic{}
|
||||
|
||||
iex> get_user_statistic!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_user_statistic!(id), do: Repo.get!(UserStatistic, id)
|
||||
|
||||
@doc """
|
||||
Creates a user_statistic.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_user_statistic(%{field: value})
|
||||
{:ok, %UserStatistic{}}
|
||||
|
||||
iex> create_user_statistic(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_user_statistic(attrs \\ %{}) do
|
||||
%UserStatistic{}
|
||||
|> UserStatistic.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a user_statistic.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_user_statistic(user_statistic, %{field: new_value})
|
||||
{:ok, %UserStatistic{}}
|
||||
|
||||
iex> update_user_statistic(user_statistic, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_user_statistic(%UserStatistic{} = user_statistic, attrs) do
|
||||
user_statistic
|
||||
|> UserStatistic.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a UserStatistic.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_user_statistic(user_statistic)
|
||||
{:ok, %UserStatistic{}}
|
||||
|
||||
iex> delete_user_statistic(user_statistic)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_user_statistic(%UserStatistic{} = user_statistic) do
|
||||
Repo.delete(user_statistic)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking user_statistic changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_user_statistic(user_statistic)
|
||||
%Ecto.Changeset{source: %UserStatistic{}}
|
||||
|
||||
"""
|
||||
def change_user_statistic(%UserStatistic{} = user_statistic) do
|
||||
UserStatistic.changeset(user_statistic, %{})
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Philomena.Users.Statistic do
|
||||
defmodule Philomena.UserStatistics.UserStatistic do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
|
@ -14,8 +14,8 @@ defmodule Philomena.Users.Statistic do
|
|||
end
|
||||
|
||||
@doc false
|
||||
def changeset(statistic, attrs) do
|
||||
statistic
|
||||
def changeset(user_statistic, attrs) do
|
||||
user_statistic
|
||||
|> cast(attrs, [])
|
||||
|> validate_required([])
|
||||
end
|
104
lib/philomena/user_whitelists.ex
Normal file
104
lib/philomena/user_whitelists.ex
Normal file
|
@ -0,0 +1,104 @@
|
|||
defmodule Philomena.UserWhitelists do
|
||||
@moduledoc """
|
||||
The UserWhitelists context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias Philomena.Repo
|
||||
|
||||
alias Philomena.UserWhitelists.UserWhitelist
|
||||
|
||||
@doc """
|
||||
Returns the list of user_whitelists.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_whitelists()
|
||||
[%UserWhitelist{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_whitelists do
|
||||
Repo.all(UserWhitelist)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single user_whitelist.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the User whitelist does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_user_whitelist!(123)
|
||||
%UserWhitelist{}
|
||||
|
||||
iex> get_user_whitelist!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_user_whitelist!(id), do: Repo.get!(UserWhitelist, id)
|
||||
|
||||
@doc """
|
||||
Creates a user_whitelist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_user_whitelist(%{field: value})
|
||||
{:ok, %UserWhitelist{}}
|
||||
|
||||
iex> create_user_whitelist(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_user_whitelist(attrs \\ %{}) do
|
||||
%UserWhitelist{}
|
||||
|> UserWhitelist.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a user_whitelist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_user_whitelist(user_whitelist, %{field: new_value})
|
||||
{:ok, %UserWhitelist{}}
|
||||
|
||||
iex> update_user_whitelist(user_whitelist, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_user_whitelist(%UserWhitelist{} = user_whitelist, attrs) do
|
||||
user_whitelist
|
||||
|> UserWhitelist.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a UserWhitelist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_user_whitelist(user_whitelist)
|
||||
{:ok, %UserWhitelist{}}
|
||||
|
||||
iex> delete_user_whitelist(user_whitelist)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_user_whitelist(%UserWhitelist{} = user_whitelist) do
|
||||
Repo.delete(user_whitelist)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking user_whitelist changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_user_whitelist(user_whitelist)
|
||||
%Ecto.Changeset{source: %UserWhitelist{}}
|
||||
|
||||
"""
|
||||
def change_user_whitelist(%UserWhitelist{} = user_whitelist) do
|
||||
UserWhitelist.changeset(user_whitelist, %{})
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Philomena.Users.Whitelist do
|
||||
defmodule Philomena.UserWhitelists.UserWhitelist do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
|
@ -8,8 +8,8 @@ defmodule Philomena.Users.Whitelist do
|
|||
end
|
||||
|
||||
@doc false
|
||||
def changeset(whitelist, attrs) do
|
||||
whitelist
|
||||
def changeset(user_whitelist, attrs) do
|
||||
user_whitelist
|
||||
|> cast(attrs, [])
|
||||
|> validate_required([])
|
||||
end
|
|
@ -102,582 +102,6 @@ defmodule Philomena.Users do
|
|||
User.changeset(user, %{})
|
||||
end
|
||||
|
||||
alias Philomena.Users.Ip
|
||||
|
||||
@doc """
|
||||
Returns the list of user_ips.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_ips()
|
||||
[%Ip{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_ips do
|
||||
Repo.all(Ip)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single ip.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the Ip does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_ip!(123)
|
||||
%Ip{}
|
||||
|
||||
iex> get_ip!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_ip!(id), do: Repo.get!(Ip, id)
|
||||
|
||||
@doc """
|
||||
Creates a ip.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_ip(%{field: value})
|
||||
{:ok, %Ip{}}
|
||||
|
||||
iex> create_ip(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_ip(attrs \\ %{}) do
|
||||
%Ip{}
|
||||
|> Ip.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a ip.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_ip(ip, %{field: new_value})
|
||||
{:ok, %Ip{}}
|
||||
|
||||
iex> update_ip(ip, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_ip(%Ip{} = ip, attrs) do
|
||||
ip
|
||||
|> Ip.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a Ip.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_ip(ip)
|
||||
{:ok, %Ip{}}
|
||||
|
||||
iex> delete_ip(ip)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_ip(%Ip{} = ip) do
|
||||
Repo.delete(ip)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking ip changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_ip(ip)
|
||||
%Ecto.Changeset{source: %Ip{}}
|
||||
|
||||
"""
|
||||
def change_ip(%Ip{} = ip) do
|
||||
Ip.changeset(ip, %{})
|
||||
end
|
||||
|
||||
alias Philomena.Users.Fingerprint
|
||||
|
||||
@doc """
|
||||
Returns the list of user_fingerprints.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_fingerprints()
|
||||
[%Fingerprint{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_fingerprints do
|
||||
Repo.all(Fingerprint)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single fingerprints.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the Fingerprint does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_fingerprints!(123)
|
||||
%Fingerprint{}
|
||||
|
||||
iex> get_fingerprints!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_fingerprints!(id), do: Repo.get!(Fingerprint, id)
|
||||
|
||||
@doc """
|
||||
Creates a fingerprints.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_fingerprints(%{field: value})
|
||||
{:ok, %Fingerprint{}}
|
||||
|
||||
iex> create_fingerprints(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_fingerprints(attrs \\ %{}) do
|
||||
%Fingerprint{}
|
||||
|> Fingerprint.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a fingerprints.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_fingerprints(fingerprints, %{field: new_value})
|
||||
{:ok, %Fingerprint{}}
|
||||
|
||||
iex> update_fingerprints(fingerprints, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_fingerprints(%Fingerprint{} = fingerprints, attrs) do
|
||||
fingerprints
|
||||
|> Fingerprint.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a Fingerprint.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_fingerprints(fingerprints)
|
||||
{:ok, %Fingerprint{}}
|
||||
|
||||
iex> delete_fingerprints(fingerprints)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_fingerprints(%Fingerprint{} = fingerprints) do
|
||||
Repo.delete(fingerprints)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking fingerprints changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_fingerprints(fingerprints)
|
||||
%Ecto.Changeset{source: %Fingerprint{}}
|
||||
|
||||
"""
|
||||
def change_fingerprints(%Fingerprint{} = fingerprints) do
|
||||
Fingerprint.changeset(fingerprints, %{})
|
||||
end
|
||||
|
||||
alias Philomena.Users.Link
|
||||
|
||||
@doc """
|
||||
Returns the list of user_links.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_links()
|
||||
[%Link{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_links do
|
||||
Repo.all(Link)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single link.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the Link does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_link!(123)
|
||||
%Link{}
|
||||
|
||||
iex> get_link!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_link!(id), do: Repo.get!(Link, id)
|
||||
|
||||
@doc """
|
||||
Creates a link.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_link(%{field: value})
|
||||
{:ok, %Link{}}
|
||||
|
||||
iex> create_link(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_link(attrs \\ %{}) do
|
||||
%Link{}
|
||||
|> Link.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a link.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_link(link, %{field: new_value})
|
||||
{:ok, %Link{}}
|
||||
|
||||
iex> update_link(link, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_link(%Link{} = link, attrs) do
|
||||
link
|
||||
|> Link.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a Link.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_link(link)
|
||||
{:ok, %Link{}}
|
||||
|
||||
iex> delete_link(link)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_link(%Link{} = link) do
|
||||
Repo.delete(link)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking link changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_link(link)
|
||||
%Ecto.Changeset{source: %Link{}}
|
||||
|
||||
"""
|
||||
def change_link(%Link{} = link) do
|
||||
Link.changeset(link, %{})
|
||||
end
|
||||
|
||||
alias Philomena.Users.NameChange
|
||||
|
||||
@doc """
|
||||
Returns the list of user_name_changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_name_changes()
|
||||
[%NameChange{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_name_changes do
|
||||
Repo.all(NameChange)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single name_change.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the Name change does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_name_change!(123)
|
||||
%NameChange{}
|
||||
|
||||
iex> get_name_change!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_name_change!(id), do: Repo.get!(NameChange, id)
|
||||
|
||||
@doc """
|
||||
Creates a name_change.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_name_change(%{field: value})
|
||||
{:ok, %NameChange{}}
|
||||
|
||||
iex> create_name_change(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_name_change(attrs \\ %{}) do
|
||||
%NameChange{}
|
||||
|> NameChange.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a name_change.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_name_change(name_change, %{field: new_value})
|
||||
{:ok, %NameChange{}}
|
||||
|
||||
iex> update_name_change(name_change, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_name_change(%NameChange{} = name_change, attrs) do
|
||||
name_change
|
||||
|> NameChange.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a NameChange.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_name_change(name_change)
|
||||
{:ok, %NameChange{}}
|
||||
|
||||
iex> delete_name_change(name_change)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_name_change(%NameChange{} = name_change) do
|
||||
Repo.delete(name_change)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking name_change changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_name_change(name_change)
|
||||
%Ecto.Changeset{source: %NameChange{}}
|
||||
|
||||
"""
|
||||
def change_name_change(%NameChange{} = name_change) do
|
||||
NameChange.changeset(name_change, %{})
|
||||
end
|
||||
|
||||
alias Philomena.Users.Statistic
|
||||
|
||||
@doc """
|
||||
Returns the list of user_statistics.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_statistics()
|
||||
[%Statistic{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_statistics do
|
||||
Repo.all(Statistic)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single statistic.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the Statistic does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_statistic!(123)
|
||||
%Statistic{}
|
||||
|
||||
iex> get_statistic!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_statistic!(id), do: Repo.get!(Statistic, id)
|
||||
|
||||
@doc """
|
||||
Creates a statistic.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_statistic(%{field: value})
|
||||
{:ok, %Statistic{}}
|
||||
|
||||
iex> create_statistic(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_statistic(attrs \\ %{}) do
|
||||
%Statistic{}
|
||||
|> Statistic.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a statistic.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_statistic(statistic, %{field: new_value})
|
||||
{:ok, %Statistic{}}
|
||||
|
||||
iex> update_statistic(statistic, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_statistic(%Statistic{} = statistic, attrs) do
|
||||
statistic
|
||||
|> Statistic.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a Statistic.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_statistic(statistic)
|
||||
{:ok, %Statistic{}}
|
||||
|
||||
iex> delete_statistic(statistic)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_statistic(%Statistic{} = statistic) do
|
||||
Repo.delete(statistic)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking statistic changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_statistic(statistic)
|
||||
%Ecto.Changeset{source: %Statistic{}}
|
||||
|
||||
"""
|
||||
def change_statistic(%Statistic{} = statistic) do
|
||||
Statistic.changeset(statistic, %{})
|
||||
end
|
||||
|
||||
alias Philomena.Users.Whitelist
|
||||
|
||||
@doc """
|
||||
Returns the list of user_whitelists.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_user_whitelists()
|
||||
[%Whitelist{}, ...]
|
||||
|
||||
"""
|
||||
def list_user_whitelists do
|
||||
Repo.all(Whitelist)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single whitelist.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the Whitelist does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_whitelist!(123)
|
||||
%Whitelist{}
|
||||
|
||||
iex> get_whitelist!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_whitelist!(id), do: Repo.get!(Whitelist, id)
|
||||
|
||||
@doc """
|
||||
Creates a whitelist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_whitelist(%{field: value})
|
||||
{:ok, %Whitelist{}}
|
||||
|
||||
iex> create_whitelist(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_whitelist(attrs \\ %{}) do
|
||||
%Whitelist{}
|
||||
|> Whitelist.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a whitelist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_whitelist(whitelist, %{field: new_value})
|
||||
{:ok, %Whitelist{}}
|
||||
|
||||
iex> update_whitelist(whitelist, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_whitelist(%Whitelist{} = whitelist, attrs) do
|
||||
whitelist
|
||||
|> Whitelist.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a Whitelist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_whitelist(whitelist)
|
||||
{:ok, %Whitelist{}}
|
||||
|
||||
iex> delete_whitelist(whitelist)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_whitelist(%Whitelist{} = whitelist) do
|
||||
Repo.delete(whitelist)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking whitelist changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_whitelist(whitelist)
|
||||
%Ecto.Changeset{source: %Whitelist{}}
|
||||
|
||||
"""
|
||||
def change_whitelist(%Whitelist{} = whitelist) do
|
||||
Whitelist.changeset(whitelist, %{})
|
||||
end
|
||||
|
||||
alias Philomena.Users.Role
|
||||
|
||||
@doc """
|
||||
|
|
|
@ -4,7 +4,7 @@ defmodule PhilomenaWeb.Plugs.EnsureUserNotLockedPlug do
|
|||
|
||||
## Example
|
||||
|
||||
plug PhilomenaWeb.EnsureUserNotLockedPlug
|
||||
plug PhilomenaWeb.Plugs.EnsureUserNotLockedPlug
|
||||
"""
|
||||
alias PhilomenaWeb.Router.Helpers, as: Routes
|
||||
alias Phoenix.Controller
|
||||
|
|
62
test/philomena/user_fingerprints_test.exs
Normal file
62
test/philomena/user_fingerprints_test.exs
Normal file
|
@ -0,0 +1,62 @@
|
|||
defmodule Philomena.UserFingerprintsTest do
|
||||
use Philomena.DataCase
|
||||
|
||||
alias Philomena.UserFingerprints
|
||||
|
||||
describe "user_fingerprints" do
|
||||
alias Philomena.UserFingerprints.UserFingerprint
|
||||
|
||||
@valid_attrs %{}
|
||||
@update_attrs %{}
|
||||
@invalid_attrs %{}
|
||||
|
||||
def user_fingerprint_fixture(attrs \\ %{}) do
|
||||
{:ok, user_fingerprint} =
|
||||
attrs
|
||||
|> Enum.into(@valid_attrs)
|
||||
|> UserFingerprints.create_user_fingerprint()
|
||||
|
||||
user_fingerprint
|
||||
end
|
||||
|
||||
test "list_user_fingerprints/0 returns all user_fingerprints" do
|
||||
user_fingerprint = user_fingerprint_fixture()
|
||||
assert UserFingerprints.list_user_fingerprints() == [user_fingerprint]
|
||||
end
|
||||
|
||||
test "get_user_fingerprint!/1 returns the user_fingerprint with given id" do
|
||||
user_fingerprint = user_fingerprint_fixture()
|
||||
assert UserFingerprints.get_user_fingerprint!(user_fingerprint.id) == user_fingerprint
|
||||
end
|
||||
|
||||
test "create_user_fingerprint/1 with valid data creates a user_fingerprint" do
|
||||
assert {:ok, %UserFingerprint{} = user_fingerprint} = UserFingerprints.create_user_fingerprint(@valid_attrs)
|
||||
end
|
||||
|
||||
test "create_user_fingerprint/1 with invalid data returns error changeset" do
|
||||
assert {:error, %Ecto.Changeset{}} = UserFingerprints.create_user_fingerprint(@invalid_attrs)
|
||||
end
|
||||
|
||||
test "update_user_fingerprint/2 with valid data updates the user_fingerprint" do
|
||||
user_fingerprint = user_fingerprint_fixture()
|
||||
assert {:ok, %UserFingerprint{} = user_fingerprint} = UserFingerprints.update_user_fingerprint(user_fingerprint, @update_attrs)
|
||||
end
|
||||
|
||||
test "update_user_fingerprint/2 with invalid data returns error changeset" do
|
||||
user_fingerprint = user_fingerprint_fixture()
|
||||
assert {:error, %Ecto.Changeset{}} = UserFingerprints.update_user_fingerprint(user_fingerprint, @invalid_attrs)
|
||||
assert user_fingerprint == UserFingerprints.get_user_fingerprint!(user_fingerprint.id)
|
||||
end
|
||||
|
||||
test "delete_user_fingerprint/1 deletes the user_fingerprint" do
|
||||
user_fingerprint = user_fingerprint_fixture()
|
||||
assert {:ok, %UserFingerprint{}} = UserFingerprints.delete_user_fingerprint(user_fingerprint)
|
||||
assert_raise Ecto.NoResultsError, fn -> UserFingerprints.get_user_fingerprint!(user_fingerprint.id) end
|
||||
end
|
||||
|
||||
test "change_user_fingerprint/1 returns a user_fingerprint changeset" do
|
||||
user_fingerprint = user_fingerprint_fixture()
|
||||
assert %Ecto.Changeset{} = UserFingerprints.change_user_fingerprint(user_fingerprint)
|
||||
end
|
||||
end
|
||||
end
|
62
test/philomena/user_ips_test.exs
Normal file
62
test/philomena/user_ips_test.exs
Normal file
|
@ -0,0 +1,62 @@
|
|||
defmodule Philomena.UserIpsTest do
|
||||
use Philomena.DataCase
|
||||
|
||||
alias Philomena.UserIps
|
||||
|
||||
describe "user_ips" do
|
||||
alias Philomena.UserIps.UserIp
|
||||
|
||||
@valid_attrs %{}
|
||||
@update_attrs %{}
|
||||
@invalid_attrs %{}
|
||||
|
||||
def user_ip_fixture(attrs \\ %{}) do
|
||||
{:ok, user_ip} =
|
||||
attrs
|
||||
|> Enum.into(@valid_attrs)
|
||||
|> UserIps.create_user_ip()
|
||||
|
||||
user_ip
|
||||
end
|
||||
|
||||
test "list_user_ips/0 returns all user_ips" do
|
||||
user_ip = user_ip_fixture()
|
||||
assert UserIps.list_user_ips() == [user_ip]
|
||||
end
|
||||
|
||||
test "get_user_ip!/1 returns the user_ip with given id" do
|
||||
user_ip = user_ip_fixture()
|
||||
assert UserIps.get_user_ip!(user_ip.id) == user_ip
|
||||
end
|
||||
|
||||
test "create_user_ip/1 with valid data creates a user_ip" do
|
||||
assert {:ok, %UserIp{} = user_ip} = UserIps.create_user_ip(@valid_attrs)
|
||||
end
|
||||
|
||||
test "create_user_ip/1 with invalid data returns error changeset" do
|
||||
assert {:error, %Ecto.Changeset{}} = UserIps.create_user_ip(@invalid_attrs)
|
||||
end
|
||||
|
||||
test "update_user_ip/2 with valid data updates the user_ip" do
|
||||
user_ip = user_ip_fixture()
|
||||
assert {:ok, %UserIp{} = user_ip} = UserIps.update_user_ip(user_ip, @update_attrs)
|
||||
end
|
||||
|
||||
test "update_user_ip/2 with invalid data returns error changeset" do
|
||||
user_ip = user_ip_fixture()
|
||||
assert {:error, %Ecto.Changeset{}} = UserIps.update_user_ip(user_ip, @invalid_attrs)
|
||||
assert user_ip == UserIps.get_user_ip!(user_ip.id)
|
||||
end
|
||||
|
||||
test "delete_user_ip/1 deletes the user_ip" do
|
||||
user_ip = user_ip_fixture()
|
||||
assert {:ok, %UserIp{}} = UserIps.delete_user_ip(user_ip)
|
||||
assert_raise Ecto.NoResultsError, fn -> UserIps.get_user_ip!(user_ip.id) end
|
||||
end
|
||||
|
||||
test "change_user_ip/1 returns a user_ip changeset" do
|
||||
user_ip = user_ip_fixture()
|
||||
assert %Ecto.Changeset{} = UserIps.change_user_ip(user_ip)
|
||||
end
|
||||
end
|
||||
end
|
62
test/philomena/user_links_test.exs
Normal file
62
test/philomena/user_links_test.exs
Normal file
|
@ -0,0 +1,62 @@
|
|||
defmodule Philomena.UserLinksTest do
|
||||
use Philomena.DataCase
|
||||
|
||||
alias Philomena.UserLinks
|
||||
|
||||
describe "user_links" do
|
||||
alias Philomena.UserLinks.UserLink
|
||||
|
||||
@valid_attrs %{}
|
||||
@update_attrs %{}
|
||||
@invalid_attrs %{}
|
||||
|
||||
def user_link_fixture(attrs \\ %{}) do
|
||||
{:ok, user_link} =
|
||||
attrs
|
||||
|> Enum.into(@valid_attrs)
|
||||
|> UserLinks.create_user_link()
|
||||
|
||||
user_link
|
||||
end
|
||||
|
||||
test "list_user_links/0 returns all user_links" do
|
||||
user_link = user_link_fixture()
|
||||
assert UserLinks.list_user_links() == [user_link]
|
||||
end
|
||||
|
||||
test "get_user_link!/1 returns the user_link with given id" do
|
||||
user_link = user_link_fixture()
|
||||
assert UserLinks.get_user_link!(user_link.id) == user_link
|
||||
end
|
||||
|
||||
test "create_user_link/1 with valid data creates a user_link" do
|
||||
assert {:ok, %UserLink{} = user_link} = UserLinks.create_user_link(@valid_attrs)
|
||||
end
|
||||
|
||||
test "create_user_link/1 with invalid data returns error changeset" do
|
||||
assert {:error, %Ecto.Changeset{}} = UserLinks.create_user_link(@invalid_attrs)
|
||||
end
|
||||
|
||||
test "update_user_link/2 with valid data updates the user_link" do
|
||||
user_link = user_link_fixture()
|
||||
assert {:ok, %UserLink{} = user_link} = UserLinks.update_user_link(user_link, @update_attrs)
|
||||
end
|
||||
|
||||
test "update_user_link/2 with invalid data returns error changeset" do
|
||||
user_link = user_link_fixture()
|
||||
assert {:error, %Ecto.Changeset{}} = UserLinks.update_user_link(user_link, @invalid_attrs)
|
||||
assert user_link == UserLinks.get_user_link!(user_link.id)
|
||||
end
|
||||
|
||||
test "delete_user_link/1 deletes the user_link" do
|
||||
user_link = user_link_fixture()
|
||||
assert {:ok, %UserLink{}} = UserLinks.delete_user_link(user_link)
|
||||
assert_raise Ecto.NoResultsError, fn -> UserLinks.get_user_link!(user_link.id) end
|
||||
end
|
||||
|
||||
test "change_user_link/1 returns a user_link changeset" do
|
||||
user_link = user_link_fixture()
|
||||
assert %Ecto.Changeset{} = UserLinks.change_user_link(user_link)
|
||||
end
|
||||
end
|
||||
end
|
62
test/philomena/user_name_changes_test.exs
Normal file
62
test/philomena/user_name_changes_test.exs
Normal file
|
@ -0,0 +1,62 @@
|
|||
defmodule Philomena.UserNameChangesTest do
|
||||
use Philomena.DataCase
|
||||
|
||||
alias Philomena.UserNameChanges
|
||||
|
||||
describe "user_name_changes" do
|
||||
alias Philomena.UserNameChanges.UserNameChange
|
||||
|
||||
@valid_attrs %{}
|
||||
@update_attrs %{}
|
||||
@invalid_attrs %{}
|
||||
|
||||
def user_name_change_fixture(attrs \\ %{}) do
|
||||
{:ok, user_name_change} =
|
||||
attrs
|
||||
|> Enum.into(@valid_attrs)
|
||||
|> UserNameChanges.create_user_name_change()
|
||||
|
||||
user_name_change
|
||||
end
|
||||
|
||||
test "list_user_name_changes/0 returns all user_name_changes" do
|
||||
user_name_change = user_name_change_fixture()
|
||||
assert UserNameChanges.list_user_name_changes() == [user_name_change]
|
||||
end
|
||||
|
||||
test "get_user_name_change!/1 returns the user_name_change with given id" do
|
||||
user_name_change = user_name_change_fixture()
|
||||
assert UserNameChanges.get_user_name_change!(user_name_change.id) == user_name_change
|
||||
end
|
||||
|
||||
test "create_user_name_change/1 with valid data creates a user_name_change" do
|
||||
assert {:ok, %UserNameChange{} = user_name_change} = UserNameChanges.create_user_name_change(@valid_attrs)
|
||||
end
|
||||
|
||||
test "create_user_name_change/1 with invalid data returns error changeset" do
|
||||
assert {:error, %Ecto.Changeset{}} = UserNameChanges.create_user_name_change(@invalid_attrs)
|
||||
end
|
||||
|
||||
test "update_user_name_change/2 with valid data updates the user_name_change" do
|
||||
user_name_change = user_name_change_fixture()
|
||||
assert {:ok, %UserNameChange{} = user_name_change} = UserNameChanges.update_user_name_change(user_name_change, @update_attrs)
|
||||
end
|
||||
|
||||
test "update_user_name_change/2 with invalid data returns error changeset" do
|
||||
user_name_change = user_name_change_fixture()
|
||||
assert {:error, %Ecto.Changeset{}} = UserNameChanges.update_user_name_change(user_name_change, @invalid_attrs)
|
||||
assert user_name_change == UserNameChanges.get_user_name_change!(user_name_change.id)
|
||||
end
|
||||
|
||||
test "delete_user_name_change/1 deletes the user_name_change" do
|
||||
user_name_change = user_name_change_fixture()
|
||||
assert {:ok, %UserNameChange{}} = UserNameChanges.delete_user_name_change(user_name_change)
|
||||
assert_raise Ecto.NoResultsError, fn -> UserNameChanges.get_user_name_change!(user_name_change.id) end
|
||||
end
|
||||
|
||||
test "change_user_name_change/1 returns a user_name_change changeset" do
|
||||
user_name_change = user_name_change_fixture()
|
||||
assert %Ecto.Changeset{} = UserNameChanges.change_user_name_change(user_name_change)
|
||||
end
|
||||
end
|
||||
end
|
62
test/philomena/user_statistics_test.exs
Normal file
62
test/philomena/user_statistics_test.exs
Normal file
|
@ -0,0 +1,62 @@
|
|||
defmodule Philomena.UserStatisticsTest do
|
||||
use Philomena.DataCase
|
||||
|
||||
alias Philomena.UserStatistics
|
||||
|
||||
describe "user_statistics" do
|
||||
alias Philomena.UserStatistics.UserStatistic
|
||||
|
||||
@valid_attrs %{}
|
||||
@update_attrs %{}
|
||||
@invalid_attrs %{}
|
||||
|
||||
def user_statistic_fixture(attrs \\ %{}) do
|
||||
{:ok, user_statistic} =
|
||||
attrs
|
||||
|> Enum.into(@valid_attrs)
|
||||
|> UserStatistics.create_user_statistic()
|
||||
|
||||
user_statistic
|
||||
end
|
||||
|
||||
test "list_user_statistics/0 returns all user_statistics" do
|
||||
user_statistic = user_statistic_fixture()
|
||||
assert UserStatistics.list_user_statistics() == [user_statistic]
|
||||
end
|
||||
|
||||
test "get_user_statistic!/1 returns the user_statistic with given id" do
|
||||
user_statistic = user_statistic_fixture()
|
||||
assert UserStatistics.get_user_statistic!(user_statistic.id) == user_statistic
|
||||
end
|
||||
|
||||
test "create_user_statistic/1 with valid data creates a user_statistic" do
|
||||
assert {:ok, %UserStatistic{} = user_statistic} = UserStatistics.create_user_statistic(@valid_attrs)
|
||||
end
|
||||
|
||||
test "create_user_statistic/1 with invalid data returns error changeset" do
|
||||
assert {:error, %Ecto.Changeset{}} = UserStatistics.create_user_statistic(@invalid_attrs)
|
||||
end
|
||||
|
||||
test "update_user_statistic/2 with valid data updates the user_statistic" do
|
||||
user_statistic = user_statistic_fixture()
|
||||
assert {:ok, %UserStatistic{} = user_statistic} = UserStatistics.update_user_statistic(user_statistic, @update_attrs)
|
||||
end
|
||||
|
||||
test "update_user_statistic/2 with invalid data returns error changeset" do
|
||||
user_statistic = user_statistic_fixture()
|
||||
assert {:error, %Ecto.Changeset{}} = UserStatistics.update_user_statistic(user_statistic, @invalid_attrs)
|
||||
assert user_statistic == UserStatistics.get_user_statistic!(user_statistic.id)
|
||||
end
|
||||
|
||||
test "delete_user_statistic/1 deletes the user_statistic" do
|
||||
user_statistic = user_statistic_fixture()
|
||||
assert {:ok, %UserStatistic{}} = UserStatistics.delete_user_statistic(user_statistic)
|
||||
assert_raise Ecto.NoResultsError, fn -> UserStatistics.get_user_statistic!(user_statistic.id) end
|
||||
end
|
||||
|
||||
test "change_user_statistic/1 returns a user_statistic changeset" do
|
||||
user_statistic = user_statistic_fixture()
|
||||
assert %Ecto.Changeset{} = UserStatistics.change_user_statistic(user_statistic)
|
||||
end
|
||||
end
|
||||
end
|
62
test/philomena/user_whitelists_test.exs
Normal file
62
test/philomena/user_whitelists_test.exs
Normal file
|
@ -0,0 +1,62 @@
|
|||
defmodule Philomena.UserWhitelistsTest do
|
||||
use Philomena.DataCase
|
||||
|
||||
alias Philomena.UserWhitelists
|
||||
|
||||
describe "user_whitelists" do
|
||||
alias Philomena.UserWhitelists.UserWhitelist
|
||||
|
||||
@valid_attrs %{}
|
||||
@update_attrs %{}
|
||||
@invalid_attrs %{}
|
||||
|
||||
def user_whitelist_fixture(attrs \\ %{}) do
|
||||
{:ok, user_whitelist} =
|
||||
attrs
|
||||
|> Enum.into(@valid_attrs)
|
||||
|> UserWhitelists.create_user_whitelist()
|
||||
|
||||
user_whitelist
|
||||
end
|
||||
|
||||
test "list_user_whitelists/0 returns all user_whitelists" do
|
||||
user_whitelist = user_whitelist_fixture()
|
||||
assert UserWhitelists.list_user_whitelists() == [user_whitelist]
|
||||
end
|
||||
|
||||
test "get_user_whitelist!/1 returns the user_whitelist with given id" do
|
||||
user_whitelist = user_whitelist_fixture()
|
||||
assert UserWhitelists.get_user_whitelist!(user_whitelist.id) == user_whitelist
|
||||
end
|
||||
|
||||
test "create_user_whitelist/1 with valid data creates a user_whitelist" do
|
||||
assert {:ok, %UserWhitelist{} = user_whitelist} = UserWhitelists.create_user_whitelist(@valid_attrs)
|
||||
end
|
||||
|
||||
test "create_user_whitelist/1 with invalid data returns error changeset" do
|
||||
assert {:error, %Ecto.Changeset{}} = UserWhitelists.create_user_whitelist(@invalid_attrs)
|
||||
end
|
||||
|
||||
test "update_user_whitelist/2 with valid data updates the user_whitelist" do
|
||||
user_whitelist = user_whitelist_fixture()
|
||||
assert {:ok, %UserWhitelist{} = user_whitelist} = UserWhitelists.update_user_whitelist(user_whitelist, @update_attrs)
|
||||
end
|
||||
|
||||
test "update_user_whitelist/2 with invalid data returns error changeset" do
|
||||
user_whitelist = user_whitelist_fixture()
|
||||
assert {:error, %Ecto.Changeset{}} = UserWhitelists.update_user_whitelist(user_whitelist, @invalid_attrs)
|
||||
assert user_whitelist == UserWhitelists.get_user_whitelist!(user_whitelist.id)
|
||||
end
|
||||
|
||||
test "delete_user_whitelist/1 deletes the user_whitelist" do
|
||||
user_whitelist = user_whitelist_fixture()
|
||||
assert {:ok, %UserWhitelist{}} = UserWhitelists.delete_user_whitelist(user_whitelist)
|
||||
assert_raise Ecto.NoResultsError, fn -> UserWhitelists.get_user_whitelist!(user_whitelist.id) end
|
||||
end
|
||||
|
||||
test "change_user_whitelist/1 returns a user_whitelist changeset" do
|
||||
user_whitelist = user_whitelist_fixture()
|
||||
assert %Ecto.Changeset{} = UserWhitelists.change_user_whitelist(user_whitelist)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue