split image context

This commit is contained in:
byte[] 2019-11-16 18:42:41 -05:00
parent dd52b7745b
commit 897ed77709
70 changed files with 1462 additions and 551 deletions

View file

@ -61,6 +61,7 @@ config :philomena, PhilomenaWeb.Endpoint,
# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"
config :logger, compile_time_purge_matching: [[application: :remote_ip]]
# Set up mailer
config :philomena, PhilomenaWeb.Mailer,

View file

@ -2,10 +2,13 @@ defmodule Philomena.Badges.Award do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Badges.Badge
alias Philomena.Users.User
schema "badge_awards" do
belongs_to :user, Philomena.Users.User
belongs_to :awarded_by, Philomena.Users.User
belongs_to :badge, Philomena.Badges.Badge
belongs_to :user, User
belongs_to :awarded_by, User
belongs_to :badge, Badge
field :label, :string
field :awarded_on, :naive_datetime

View file

@ -2,8 +2,10 @@ defmodule Philomena.Bans.Fingerprint do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "fingerprint_bans" do
belongs_to :banning_user, Philomena.Users.User
belongs_to :banning_user, User
field :reason, :string
field :note, :string

View file

@ -2,8 +2,10 @@ defmodule Philomena.Bans.Subnet do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "subnet_bans" do
belongs_to :banning_user, Philomena.Users.User
belongs_to :banning_user, User
field :reason, :string
field :note, :string

View file

@ -2,9 +2,11 @@ defmodule Philomena.Bans.User do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "user_bans" do
belongs_to :user, Philomena.Users.User
belongs_to :banning_user, Philomena.Users.User
belongs_to :user, User
belongs_to :banning_user, User
field :reason, :string
field :note, :string

View file

@ -2,8 +2,10 @@ defmodule Philomena.Channels.Channel do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Tags.Tag
schema "channels" do
belongs_to :associated_artist_tag, Philomena.Tags.Tag
belongs_to :associated_artist_tag, Tag
# fixme: rails STI
field :type, :string

View file

@ -2,11 +2,14 @@ defmodule Philomena.Channels.Subscription do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Channels.Channel
alias Philomena.Users.User
@primary_key false
schema "channel_subscriptions" do
belongs_to :channel, Philomena.Channels.Channel, primary_key: true
belongs_to :user, Philomena.Users.User, primary_key: true
belongs_to :channel, Channel, primary_key: true
belongs_to :user, User, primary_key: true
end
@doc false

View file

@ -7,10 +7,13 @@ defmodule Philomena.Comments.Comment do
index_name: "comments",
doc_type: "comment"
alias Philomena.Images.Image
alias Philomena.Users.User
schema "comments" do
belongs_to :user, Philomena.Users.User
belongs_to :image, Philomena.Images.Image
belongs_to :deleted_by, Philomena.Users.User
belongs_to :user, User
belongs_to :image, Image
belongs_to :deleted_by, User
field :body, :string
field :ip, EctoNetwork.INET

View file

@ -2,9 +2,12 @@ defmodule Philomena.Commissions.Commission do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Images.Image
alias Philomena.Users.User
schema "commissions" do
belongs_to :user, Philomena.Users.User
belongs_to :sheet_image, Philomena.Images.Image
belongs_to :user, User
belongs_to :sheet_image, Image
field :open, :boolean
field :categories, {:array, :string}, default: []

View file

@ -2,9 +2,12 @@ defmodule Philomena.Commissions.Item do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Commissions.Commission
alias Philomena.Images.Image
schema "commission_items" do
belongs_to :commission, Philomena.Commissions.Commission
belongs_to :example_image, Philomena.Images.Image
belongs_to :commission, Commission
belongs_to :example_image, Image
field :item_type, :string
field :description, :string

View file

@ -2,11 +2,13 @@ defmodule Philomena.Conversations.Conversation do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
@derive {Phoenix.Param, key: :slug}
schema "conversations" do
belongs_to :from, Philomena.Users.User
belongs_to :to, Philomena.Users.User
belongs_to :from, User
belongs_to :to, User
field :title, :string
field :to_read, :boolean, default: false

View file

@ -2,9 +2,12 @@ defmodule Philomena.Conversations.Message do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Conversations.Conversation
alias Philomena.Users.User
schema "messages" do
belongs_to :conversation, Philomena.Conversations.Conversation
belongs_to :from, Philomena.Users.User
belongs_to :conversation, Conversation
belongs_to :from, User
field :body, :string

View file

@ -2,10 +2,13 @@ defmodule Philomena.DnpEntries.DnpEntry do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Tags.Tag
alias Philomena.Users.User
schema "dnp_entries" do
belongs_to :requesting_user, Philomena.Users.User
belongs_to :modifying_user, Philomena.Users.User
belongs_to :tag, Philomena.Tags.Tag
belongs_to :requesting_user, User
belongs_to :modifying_user, User
belongs_to :tag, Tag
field :aasm_state, :string, default: "requested"
field :dnp_type, :string

View file

@ -2,8 +2,10 @@ defmodule Philomena.Donations.Donation do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "donations" do
belongs_to :user, Philomena.Users.User
belongs_to :user, User
field :email, :string
field :amount, :decimal

View file

@ -2,11 +2,14 @@ defmodule Philomena.DuplicateReports.DuplicateReport do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Images.Image
alias Philomena.Users.User
schema "duplicate_reports" do
belongs_to :image, Philomena.Images.Image
belongs_to :duplicate_of_image, Philomena.Images.Image
belongs_to :user, Philomena.Users.User
belongs_to :modifier, Philomena.Users.User
belongs_to :image, Image
belongs_to :duplicate_of_image, Image
belongs_to :user, User
belongs_to :modifier, User
field :reason, :string
field :state, :string, default: "open"

View file

@ -2,10 +2,13 @@ defmodule Philomena.Forums.Forum do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Posts.Post
alias Philomena.Topics.Topic
@derive {Phoenix.Param, key: :short_name}
schema "forums" do
belongs_to :last_post, Philomena.Posts.Post
belongs_to :last_topic, Philomena.Topics.Topic
belongs_to :last_post, Post
belongs_to :last_topic, Topic
field :name, :string
field :short_name, :string

View file

@ -2,11 +2,14 @@ defmodule Philomena.Forums.Subscription do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Forums.Forum
alias Philomena.Users.User
@primary_key false
schema "forum_subscriptions" do
belongs_to :forum, Philomena.Forums.Forum, primary_key: true
belongs_to :user, Philomena.Users.User, primary_key: true
belongs_to :forum, Forum, primary_key: true
belongs_to :user, User, primary_key: true
end
@doc false

View file

@ -2,9 +2,12 @@ defmodule Philomena.Galleries.Gallery do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Images.Image
alias Philomena.Users.User
schema "galleries" do
belongs_to :thumbnail, Philomena.Images.Image, source: :thumbnail_id
belongs_to :creator, Philomena.Users.User, source: :creator_id
belongs_to :thumbnail, Image, source: :thumbnail_id
belongs_to :creator, User, source: :creator_id
field :title, :string
field :spoiler_warning, :string

View file

@ -2,11 +2,14 @@ defmodule Philomena.Galleries.Interaction do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Galleries.Gallery
alias Philomena.Images.Image
@primary_key false
schema "gallery_interactions" do
belongs_to :gallery, Philomena.Galleries.Gallery, primary_key: true
belongs_to :image, Philomena.Images.Image, primary_key: true
belongs_to :gallery, Gallery, primary_key: true
belongs_to :image, Image, primary_key: true
field :position, :integer
end

View file

@ -2,11 +2,14 @@ defmodule Philomena.Galleries.Subscription do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Galleries.Gallery
alias Philomena.Users.User
@primary_key false
schema "gallery_subscriptions" do
belongs_to :gallery, Philomena.Galleries.Gallery, primary_key: true
belongs_to :user, Philomena.Users.User, primary_key: true
belongs_to :gallery, Gallery, primary_key: true
belongs_to :user, User, primary_key: true
end
@doc false

View file

@ -0,0 +1,104 @@
defmodule Philomena.ImageFaves do
@moduledoc """
The ImageFaves context.
"""
import Ecto.Query, warn: false
alias Philomena.Repo
alias Philomena.ImageFaves.ImageFave
@doc """
Returns the list of image_faves.
## Examples
iex> list_image_faves()
[%ImageFave{}, ...]
"""
def list_image_faves do
Repo.all(ImageFave)
end
@doc """
Gets a single image_fave.
Raises `Ecto.NoResultsError` if the Image fave does not exist.
## Examples
iex> get_image_fave!(123)
%ImageFave{}
iex> get_image_fave!(456)
** (Ecto.NoResultsError)
"""
def get_image_fave!(id), do: Repo.get!(ImageFave, id)
@doc """
Creates a image_fave.
## Examples
iex> create_image_fave(%{field: value})
{:ok, %ImageFave{}}
iex> create_image_fave(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_image_fave(attrs \\ %{}) do
%ImageFave{}
|> ImageFave.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a image_fave.
## Examples
iex> update_image_fave(image_fave, %{field: new_value})
{:ok, %ImageFave{}}
iex> update_image_fave(image_fave, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_image_fave(%ImageFave{} = image_fave, attrs) do
image_fave
|> ImageFave.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a ImageFave.
## Examples
iex> delete_image_fave(image_fave)
{:ok, %ImageFave{}}
iex> delete_image_fave(image_fave)
{:error, %Ecto.Changeset{}}
"""
def delete_image_fave(%ImageFave{} = image_fave) do
Repo.delete(image_fave)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking image_fave changes.
## Examples
iex> change_image_fave(image_fave)
%Ecto.Changeset{source: %ImageFave{}}
"""
def change_image_fave(%ImageFave{} = image_fave) do
ImageFave.changeset(image_fave, %{})
end
end

View file

@ -0,0 +1,22 @@
defmodule Philomena.ImageFaves.ImageFave do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Images.Image
alias Philomena.Users.User
@primary_key false
schema "image_faves" do
belongs_to :user, User, primary_key: true
belongs_to :image, Image, primary_key: true
timestamps(inserted_at: :created_at, updated_at: false)
end
@doc false
def changeset(image_fave, attrs) do
image_fave
|> cast(attrs, [])
|> validate_required([])
end
end

View file

@ -0,0 +1,104 @@
defmodule Philomena.ImageFeatures do
@moduledoc """
The ImageFeatures context.
"""
import Ecto.Query, warn: false
alias Philomena.Repo
alias Philomena.ImageFeatures.ImageFeature
@doc """
Returns the list of image_features.
## Examples
iex> list_image_features()
[%ImageFeature{}, ...]
"""
def list_image_features do
Repo.all(ImageFeature)
end
@doc """
Gets a single image_feature.
Raises `Ecto.NoResultsError` if the Image feature does not exist.
## Examples
iex> get_image_feature!(123)
%ImageFeature{}
iex> get_image_feature!(456)
** (Ecto.NoResultsError)
"""
def get_image_feature!(id), do: Repo.get!(ImageFeature, id)
@doc """
Creates a image_feature.
## Examples
iex> create_image_feature(%{field: value})
{:ok, %ImageFeature{}}
iex> create_image_feature(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_image_feature(attrs \\ %{}) do
%ImageFeature{}
|> ImageFeature.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a image_feature.
## Examples
iex> update_image_feature(image_feature, %{field: new_value})
{:ok, %ImageFeature{}}
iex> update_image_feature(image_feature, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_image_feature(%ImageFeature{} = image_feature, attrs) do
image_feature
|> ImageFeature.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a ImageFeature.
## Examples
iex> delete_image_feature(image_feature)
{:ok, %ImageFeature{}}
iex> delete_image_feature(image_feature)
{:error, %Ecto.Changeset{}}
"""
def delete_image_feature(%ImageFeature{} = image_feature) do
Repo.delete(image_feature)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking image_feature changes.
## Examples
iex> change_image_feature(image_feature)
%Ecto.Changeset{source: %ImageFeature{}}
"""
def change_image_feature(%ImageFeature{} = image_feature) do
ImageFeature.changeset(image_feature, %{})
end
end

View file

@ -0,0 +1,23 @@
defmodule Philomena.ImageFeatures.ImageFeature do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Images.Image
alias Philomena.Users.User
@primary_key false
schema "image_features" do
belongs_to :image, Image
belongs_to :user, User
timestamps(inserted_at: :created_at)
end
@doc false
def changeset(image_feature, attrs) do
image_feature
|> cast(attrs, [])
|> validate_required([])
end
end

View file

@ -0,0 +1,104 @@
defmodule Philomena.ImageHides do
@moduledoc """
The ImageHides context.
"""
import Ecto.Query, warn: false
alias Philomena.Repo
alias Philomena.ImageHides.ImageHide
@doc """
Returns the list of image_hides.
## Examples
iex> list_image_hides()
[%ImageHide{}, ...]
"""
def list_image_hides do
Repo.all(ImageHide)
end
@doc """
Gets a single image_hide.
Raises `Ecto.NoResultsError` if the Image hide does not exist.
## Examples
iex> get_image_hide!(123)
%ImageHide{}
iex> get_image_hide!(456)
** (Ecto.NoResultsError)
"""
def get_image_hide!(id), do: Repo.get!(ImageHide, id)
@doc """
Creates a image_hide.
## Examples
iex> create_image_hide(%{field: value})
{:ok, %ImageHide{}}
iex> create_image_hide(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_image_hide(attrs \\ %{}) do
%ImageHide{}
|> ImageHide.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a image_hide.
## Examples
iex> update_image_hide(image_hide, %{field: new_value})
{:ok, %ImageHide{}}
iex> update_image_hide(image_hide, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_image_hide(%ImageHide{} = image_hide, attrs) do
image_hide
|> ImageHide.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a ImageHide.
## Examples
iex> delete_image_hide(image_hide)
{:ok, %ImageHide{}}
iex> delete_image_hide(image_hide)
{:error, %Ecto.Changeset{}}
"""
def delete_image_hide(%ImageHide{} = image_hide) do
Repo.delete(image_hide)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking image_hide changes.
## Examples
iex> change_image_hide(image_hide)
%Ecto.Changeset{source: %ImageHide{}}
"""
def change_image_hide(%ImageHide{} = image_hide) do
ImageHide.changeset(image_hide, %{})
end
end

View file

@ -0,0 +1,22 @@
defmodule Philomena.ImageHides.ImageHide do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Images.Image
alias Philomena.Users.User
@primary_key false
schema "image_hides" do
belongs_to :user, User, primary_key: true
belongs_to :image, Image, primary_key: true
timestamps(inserted_at: :created_at, updated_at: false)
end
@doc false
def changeset(image_hide, attrs) do
image_hide
|> cast(attrs, [])
|> validate_required([])
end
end

View file

@ -0,0 +1,104 @@
defmodule Philomena.ImageIntensities do
@moduledoc """
The ImageIntensities context.
"""
import Ecto.Query, warn: false
alias Philomena.Repo
alias Philomena.ImageIntensities.ImageIntensity
@doc """
Returns the list of image_intensities.
## Examples
iex> list_image_intensities()
[%ImageIntensity{}, ...]
"""
def list_image_intensities do
Repo.all(ImageIntensity)
end
@doc """
Gets a single image_intensity.
Raises `Ecto.NoResultsError` if the Image intensity does not exist.
## Examples
iex> get_image_intensity!(123)
%ImageIntensity{}
iex> get_image_intensity!(456)
** (Ecto.NoResultsError)
"""
def get_image_intensity!(id), do: Repo.get!(ImageIntensity, id)
@doc """
Creates a image_intensity.
## Examples
iex> create_image_intensity(%{field: value})
{:ok, %ImageIntensity{}}
iex> create_image_intensity(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_image_intensity(attrs \\ %{}) do
%ImageIntensity{}
|> ImageIntensity.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a image_intensity.
## Examples
iex> update_image_intensity(image_intensity, %{field: new_value})
{:ok, %ImageIntensity{}}
iex> update_image_intensity(image_intensity, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_image_intensity(%ImageIntensity{} = image_intensity, attrs) do
image_intensity
|> ImageIntensity.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a ImageIntensity.
## Examples
iex> delete_image_intensity(image_intensity)
{:ok, %ImageIntensity{}}
iex> delete_image_intensity(image_intensity)
{:error, %Ecto.Changeset{}}
"""
def delete_image_intensity(%ImageIntensity{} = image_intensity) do
Repo.delete(image_intensity)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking image_intensity changes.
## Examples
iex> change_image_intensity(image_intensity)
%Ecto.Changeset{source: %ImageIntensity{}}
"""
def change_image_intensity(%ImageIntensity{} = image_intensity) do
ImageIntensity.changeset(image_intensity, %{})
end
end

View file

@ -1,11 +1,13 @@
defmodule Philomena.Images.Intensities do
defmodule Philomena.ImageIntensities.ImageIntensity do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Images.Image
@primary_key false
schema "image_intensities" do
belongs_to :image, Philomena.Images.Image, primary_key: true
belongs_to :image, Image, primary_key: true
field :nw, :float
field :ne, :float
@ -14,8 +16,8 @@ defmodule Philomena.Images.Intensities do
end
@doc false
def changeset(intensities, attrs) do
intensities
def changeset(image_intensity, attrs) do
image_intensity
|> cast(attrs, [])
|> validate_required([])
end

View file

@ -0,0 +1,104 @@
defmodule Philomena.ImageVotes do
@moduledoc """
The ImageVotes context.
"""
import Ecto.Query, warn: false
alias Philomena.Repo
alias Philomena.ImageVotes.ImageVote
@doc """
Returns the list of image_votes.
## Examples
iex> list_image_votes()
[%ImageVote{}, ...]
"""
def list_image_votes do
Repo.all(ImageVote)
end
@doc """
Gets a single image_vote.
Raises `Ecto.NoResultsError` if the Image vote does not exist.
## Examples
iex> get_image_vote!(123)
%ImageVote{}
iex> get_image_vote!(456)
** (Ecto.NoResultsError)
"""
def get_image_vote!(id), do: Repo.get!(ImageVote, id)
@doc """
Creates a image_vote.
## Examples
iex> create_image_vote(%{field: value})
{:ok, %ImageVote{}}
iex> create_image_vote(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_image_vote(attrs \\ %{}) do
%ImageVote{}
|> ImageVote.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a image_vote.
## Examples
iex> update_image_vote(image_vote, %{field: new_value})
{:ok, %ImageVote{}}
iex> update_image_vote(image_vote, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_image_vote(%ImageVote{} = image_vote, attrs) do
image_vote
|> ImageVote.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a ImageVote.
## Examples
iex> delete_image_vote(image_vote)
{:ok, %ImageVote{}}
iex> delete_image_vote(image_vote)
{:error, %Ecto.Changeset{}}
"""
def delete_image_vote(%ImageVote{} = image_vote) do
Repo.delete(image_vote)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking image_vote changes.
## Examples
iex> change_image_vote(image_vote)
%Ecto.Changeset{source: %ImageVote{}}
"""
def change_image_vote(%ImageVote{} = image_vote) do
ImageVote.changeset(image_vote, %{})
end
end

View file

@ -1,19 +1,22 @@
defmodule Philomena.Images.Vote do
defmodule Philomena.ImageVotes.ImageVote do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Images.Image
alias Philomena.Users.User
@primary_key false
schema "image_votes" do
belongs_to :user, Philomena.Users.User, primary_key: true
belongs_to :image, Philomena.Images.Image, primary_key: true
belongs_to :user, User, primary_key: true
belongs_to :image, Image, primary_key: true
field :up, :boolean
timestamps(inserted_at: :created_at, updated_at: false)
end
@doc false
def changeset(vote, attrs) do
vote
def changeset(image_vote, attrs) do
image_vote
|> cast(attrs, [])
|> validate_required([])
end

View file

@ -104,198 +104,6 @@ defmodule Philomena.Images do
Image.changeset(image, %{})
end
alias Philomena.Images.Feature
@doc """
Returns the list of image_features.
## Examples
iex> list_image_features()
[%Feature{}, ...]
"""
def list_image_features do
Repo.all(Feature)
end
@doc """
Gets a single features.
Raises `Ecto.NoResultsError` if the Feature does not exist.
## Examples
iex> get_features!(123)
%Feature{}
iex> get_features!(456)
** (Ecto.NoResultsError)
"""
def get_features!(id), do: Repo.get!(Feature, id)
@doc """
Creates a features.
## Examples
iex> create_features(%{field: value})
{:ok, %Feature{}}
iex> create_features(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_features(attrs \\ %{}) do
%Feature{}
|> Feature.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a features.
## Examples
iex> update_features(features, %{field: new_value})
{:ok, %Feature{}}
iex> update_features(features, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_features(%Feature{} = features, attrs) do
features
|> Feature.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a Feature.
## Examples
iex> delete_features(features)
{:ok, %Feature{}}
iex> delete_features(features)
{:error, %Ecto.Changeset{}}
"""
def delete_features(%Feature{} = features) do
Repo.delete(features)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking features changes.
## Examples
iex> change_features(features)
%Ecto.Changeset{source: %Feature{}}
"""
def change_features(%Feature{} = features) do
Feature.changeset(features, %{})
end
alias Philomena.Images.Intensities
@doc """
Returns the list of image_intensities.
## Examples
iex> list_image_intensities()
[%Intensities{}, ...]
"""
def list_image_intensities do
Repo.all(Intensities)
end
@doc """
Gets a single intensities.
Raises `Ecto.NoResultsError` if the Intensities does not exist.
## Examples
iex> get_intensities!(123)
%Intensities{}
iex> get_intensities!(456)
** (Ecto.NoResultsError)
"""
def get_intensities!(id), do: Repo.get!(Intensities, id)
@doc """
Creates a intensities.
## Examples
iex> create_intensities(%{field: value})
{:ok, %Intensities{}}
iex> create_intensities(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_intensities(attrs \\ %{}) do
%Intensities{}
|> Intensities.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a intensities.
## Examples
iex> update_intensities(intensities, %{field: new_value})
{:ok, %Intensities{}}
iex> update_intensities(intensities, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_intensities(%Intensities{} = intensities, attrs) do
intensities
|> Intensities.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a Intensities.
## Examples
iex> delete_intensities(intensities)
{:ok, %Intensities{}}
iex> delete_intensities(intensities)
{:error, %Ecto.Changeset{}}
"""
def delete_intensities(%Intensities{} = intensities) do
Repo.delete(intensities)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking intensities changes.
## Examples
iex> change_intensities(intensities)
%Ecto.Changeset{source: %Intensities{}}
"""
def change_intensities(%Intensities{} = intensities) do
Intensities.changeset(intensities, %{})
end
alias Philomena.Images.Subscription
@doc """
@ -391,196 +199,4 @@ defmodule Philomena.Images do
def change_subscription(%Subscription{} = subscription) do
Subscription.changeset(subscription, %{})
end
alias Philomena.Images.SourceChange
@doc """
Returns the list of source_changes.
## Examples
iex> list_source_changes()
[%SourceChange{}, ...]
"""
def list_source_changes do
Repo.all(SourceChange)
end
@doc """
Gets a single source_change.
Raises `Ecto.NoResultsError` if the Source change does not exist.
## Examples
iex> get_source_change!(123)
%SourceChange{}
iex> get_source_change!(456)
** (Ecto.NoResultsError)
"""
def get_source_change!(id), do: Repo.get!(SourceChange, id)
@doc """
Creates a source_change.
## Examples
iex> create_source_change(%{field: value})
{:ok, %SourceChange{}}
iex> create_source_change(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_source_change(attrs \\ %{}) do
%SourceChange{}
|> SourceChange.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a source_change.
## Examples
iex> update_source_change(source_change, %{field: new_value})
{:ok, %SourceChange{}}
iex> update_source_change(source_change, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_source_change(%SourceChange{} = source_change, attrs) do
source_change
|> SourceChange.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a SourceChange.
## Examples
iex> delete_source_change(source_change)
{:ok, %SourceChange{}}
iex> delete_source_change(source_change)
{:error, %Ecto.Changeset{}}
"""
def delete_source_change(%SourceChange{} = source_change) do
Repo.delete(source_change)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking source_change changes.
## Examples
iex> change_source_change(source_change)
%Ecto.Changeset{source: %SourceChange{}}
"""
def change_source_change(%SourceChange{} = source_change) do
SourceChange.changeset(source_change, %{})
end
alias Philomena.Images.TagChange
@doc """
Returns the list of tag_changes.
## Examples
iex> list_tag_changes()
[%TagChange{}, ...]
"""
def list_tag_changes do
Repo.all(TagChange)
end
@doc """
Gets a single tag_change.
Raises `Ecto.NoResultsError` if the Tag change does not exist.
## Examples
iex> get_tag_change!(123)
%TagChange{}
iex> get_tag_change!(456)
** (Ecto.NoResultsError)
"""
def get_tag_change!(id), do: Repo.get!(TagChange, id)
@doc """
Creates a tag_change.
## Examples
iex> create_tag_change(%{field: value})
{:ok, %TagChange{}}
iex> create_tag_change(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_tag_change(attrs \\ %{}) do
%TagChange{}
|> TagChange.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a tag_change.
## Examples
iex> update_tag_change(tag_change, %{field: new_value})
{:ok, %TagChange{}}
iex> update_tag_change(tag_change, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_tag_change(%TagChange{} = tag_change, attrs) do
tag_change
|> TagChange.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a TagChange.
## Examples
iex> delete_tag_change(tag_change)
{:ok, %TagChange{}}
iex> delete_tag_change(tag_change)
{:error, %Ecto.Changeset{}}
"""
def delete_tag_change(%TagChange{} = tag_change) do
Repo.delete(tag_change)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking tag_change changes.
## Examples
iex> change_tag_change(tag_change)
%Ecto.Changeset{source: %TagChange{}}
"""
def change_tag_change(%TagChange{} = tag_change) do
TagChange.changeset(tag_change, %{})
end
end

View file

@ -1,19 +0,0 @@
defmodule Philomena.Images.Fave do
use Ecto.Schema
import Ecto.Changeset
@primary_key false
schema "image_faves" do
belongs_to :user, Philomena.Users.User, primary_key: true
belongs_to :image, Philomena.Images.Image, primary_key: true
timestamps(inserted_at: :created_at, updated_at: false)
end
@doc false
def changeset(fave, attrs) do
fave
|> cast(attrs, [])
|> validate_required([])
end
end

View file

@ -1,20 +0,0 @@
defmodule Philomena.Images.Feature do
use Ecto.Schema
import Ecto.Changeset
@primary_key false
schema "image_features" do
belongs_to :image, Philomena.Images.Image
belongs_to :user, Philomena.Users.User
timestamps(inserted_at: :created_at)
end
@doc false
def changeset(features, attrs) do
features
|> cast(attrs, [])
|> validate_required([])
end
end

View file

@ -1,19 +0,0 @@
defmodule Philomena.Images.Hide do
use Ecto.Schema
import Ecto.Changeset
@primary_key false
schema "image_hides" do
belongs_to :user, Philomena.Users.User, primary_key: true
belongs_to :image, Philomena.Images.Image, primary_key: true
timestamps(inserted_at: :created_at, updated_at: false)
end
@doc false
def changeset(hide, attrs) do
hide
|> cast(attrs, [])
|> validate_required([])
end
end

View file

@ -8,15 +8,22 @@ defmodule Philomena.Images.Image do
import Ecto.Changeset
alias Philomena.ImageVotes.ImageVote
alias Philomena.ImageFaves.ImageFave
alias Philomena.ImageHides.ImageHide
alias Philomena.Users.User
alias Philomena.Images.Tagging
alias Philomena.Galleries
schema "images" do
belongs_to :user, Philomena.Users.User
belongs_to :deleter, Philomena.Users.User, source: :deleted_by_id
has_many :upvotes, Philomena.Images.Vote, where: [up: true]
has_many :downvotes, Philomena.Images.Vote, where: [up: false]
has_many :faves, Philomena.Images.Fave
has_many :hides, Philomena.Images.Hide
has_many :taggings, Philomena.Images.Tagging
has_many :gallery_interactions, Philomena.Galleries.Interaction
belongs_to :user, User
belongs_to :deleter, User, source: :deleted_by_id
has_many :upvotes, ImageVote, where: [up: true]
has_many :downvotes, ImageVote, where: [up: false]
has_many :faves, ImageFave
has_many :hides, ImageHide
has_many :taggings, Tagging
has_many :gallery_interactions, Galleries.Interaction
has_many :tags, through: [:taggings, :tag]
has_many :upvoters, through: [:upvotes, :user]
has_many :downvoters, through: [:downvotes, :user]

View file

@ -2,11 +2,14 @@ defmodule Philomena.Images.Subscription do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Images.Image
alias Philomena.Users.User
@primary_key false
schema "image_subscriptions" do
belongs_to :image, Philomena.Images.Image, primary_key: true
belongs_to :user, Philomena.Users.User, primary_key: true
belongs_to :image, Image, primary_key: true
belongs_to :user, User, primary_key: true
end
@doc false

View file

@ -2,11 +2,14 @@ defmodule Philomena.Images.Tagging do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Images.Image
alias Philomena.Tags.Tag
@primary_key false
schema "image_taggings" do
belongs_to :image, Philomena.Images.Image, primary_key: true
belongs_to :tag, Philomena.Tags.Tag, primary_key: true
belongs_to :image, Image, primary_key: true
belongs_to :tag, Tag, primary_key: true
end
@doc false

View file

@ -2,8 +2,10 @@ defmodule Philomena.ModNotes.ModNote do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "mod_notes" do
belongs_to :moderator, Philomena.Users.User
belongs_to :moderator, User
# fixme: rails polymorphic relation
field :notable_id, :integer

View file

@ -2,11 +2,14 @@ defmodule Philomena.Notifications.UnreadNotification do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
alias Philomena.Notifications.Notification
@primary_key false
schema "unread_notifications" do
belongs_to :user, Philomena.Users.User, primary_key: true
belongs_to :notification, Philomena.Notifications.Notification, primary_key: true
belongs_to :user, User, primary_key: true
belongs_to :notification, Notification, primary_key: true
end
@doc false

View file

@ -2,8 +2,10 @@ defmodule Philomena.PollOptions.PollOption do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Polls.Poll
schema "poll_options" do
belongs_to :poll, Philomena.Polls.Poll
belongs_to :poll, Poll
field :label, :string
field :vote_count, :integer, default: 0

View file

@ -2,9 +2,12 @@ defmodule Philomena.PollVotes.PollVote do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.PollOptions.PollOption
alias Philomena.Users.User
schema "poll_votes" do
belongs_to :poll_option, Philomena.PollOptions.PollOption
belongs_to :user, Philomena.Users.User
belongs_to :poll_option, PollOption
belongs_to :user, User
field :rank, :integer

View file

@ -2,9 +2,12 @@ defmodule Philomena.Polls.Poll do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Topics.Topic
alias Philomena.Users.User
schema "polls" do
belongs_to :topic, Philomena.Topics.Topic
belongs_to :deleted_by, Philomena.Users.User
belongs_to :topic, Topic
belongs_to :deleted_by, User
field :title, :string
field :vote_method, :string

View file

@ -2,10 +2,13 @@ defmodule Philomena.Posts.Post do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
alias Philomena.Topics.Topic
schema "posts" do
belongs_to :user, Philomena.Users.User
belongs_to :topic, Philomena.Topics.Topic
belongs_to :deleted_by, Philomena.Users.User
belongs_to :user, User
belongs_to :topic, Topic
belongs_to :deleted_by, User
field :body, :string
field :edit_reason, :string

View file

@ -2,9 +2,11 @@ defmodule Philomena.Reports.Report do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "reports" do
belongs_to :user, Philomena.Users.User
belongs_to :admin, Philomena.Users.User
belongs_to :user, User
belongs_to :admin, User
field :ip, EctoNetwork.INET
field :fingerprint, :string

View file

@ -2,8 +2,10 @@ defmodule Philomena.SiteNotices.SiteNotice do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "site_notices" do
belongs_to :user, Philomena.Users.User
belongs_to :user, User
field :title, :string
field :text, :string

View file

@ -0,0 +1,104 @@
defmodule Philomena.SourceChanges do
@moduledoc """
The SourceChanges context.
"""
import Ecto.Query, warn: false
alias Philomena.Repo
alias Philomena.SourceChanges.SourceChange
@doc """
Returns the list of source_changes.
## Examples
iex> list_source_changes()
[%SourceChange{}, ...]
"""
def list_source_changes do
Repo.all(SourceChange)
end
@doc """
Gets a single source_change.
Raises `Ecto.NoResultsError` if the Source change does not exist.
## Examples
iex> get_source_change!(123)
%SourceChange{}
iex> get_source_change!(456)
** (Ecto.NoResultsError)
"""
def get_source_change!(id), do: Repo.get!(SourceChange, id)
@doc """
Creates a source_change.
## Examples
iex> create_source_change(%{field: value})
{:ok, %SourceChange{}}
iex> create_source_change(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_source_change(attrs \\ %{}) do
%SourceChange{}
|> SourceChange.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a source_change.
## Examples
iex> update_source_change(source_change, %{field: new_value})
{:ok, %SourceChange{}}
iex> update_source_change(source_change, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_source_change(%SourceChange{} = source_change, attrs) do
source_change
|> SourceChange.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a SourceChange.
## Examples
iex> delete_source_change(source_change)
{:ok, %SourceChange{}}
iex> delete_source_change(source_change)
{:error, %Ecto.Changeset{}}
"""
def delete_source_change(%SourceChange{} = source_change) do
Repo.delete(source_change)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking source_change changes.
## Examples
iex> change_source_change(source_change)
%Ecto.Changeset{source: %SourceChange{}}
"""
def change_source_change(%SourceChange{} = source_change) do
SourceChange.changeset(source_change, %{})
end
end

View file

@ -1,4 +1,4 @@
defmodule Philomena.Images.SourceChange do
defmodule Philomena.SourceChanges.SourceChange do
use Ecto.Schema
import Ecto.Changeset

View file

@ -0,0 +1,104 @@
defmodule Philomena.TagChanges do
@moduledoc """
The TagChanges context.
"""
import Ecto.Query, warn: false
alias Philomena.Repo
alias Philomena.TagChanges.TagChange
@doc """
Returns the list of tag_changes.
## Examples
iex> list_tag_changes()
[%TagChange{}, ...]
"""
def list_tag_changes do
Repo.all(TagChange)
end
@doc """
Gets a single tag_change.
Raises `Ecto.NoResultsError` if the Tag change does not exist.
## Examples
iex> get_tag_change!(123)
%TagChange{}
iex> get_tag_change!(456)
** (Ecto.NoResultsError)
"""
def get_tag_change!(id), do: Repo.get!(TagChange, id)
@doc """
Creates a tag_change.
## Examples
iex> create_tag_change(%{field: value})
{:ok, %TagChange{}}
iex> create_tag_change(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_tag_change(attrs \\ %{}) do
%TagChange{}
|> TagChange.changeset(attrs)
|> Repo.insert()
end
@doc """
Updates a tag_change.
## Examples
iex> update_tag_change(tag_change, %{field: new_value})
{:ok, %TagChange{}}
iex> update_tag_change(tag_change, %{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def update_tag_change(%TagChange{} = tag_change, attrs) do
tag_change
|> TagChange.changeset(attrs)
|> Repo.update()
end
@doc """
Deletes a TagChange.
## Examples
iex> delete_tag_change(tag_change)
{:ok, %TagChange{}}
iex> delete_tag_change(tag_change)
{:error, %Ecto.Changeset{}}
"""
def delete_tag_change(%TagChange{} = tag_change) do
Repo.delete(tag_change)
end
@doc """
Returns an `%Ecto.Changeset{}` for tracking tag_change changes.
## Examples
iex> change_tag_change(tag_change)
%Ecto.Changeset{source: %TagChange{}}
"""
def change_tag_change(%TagChange{} = tag_change) do
TagChange.changeset(tag_change, %{})
end
end

View file

@ -1,4 +1,4 @@
defmodule Philomena.Images.TagChange do
defmodule Philomena.TagChanges.TagChange do
use Ecto.Schema
import Ecto.Changeset

View file

@ -2,11 +2,13 @@ defmodule Philomena.Tags.Implication do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Tags.Tag
@primary_key false
schema "tags_implied_tags" do
belongs_to :tag, Philomena.Tags.Tag, primary_key: true
belongs_to :implied_tag, Philomena.Tags.Tag, primary_key: true
belongs_to :tag, Tag, primary_key: true
belongs_to :implied_tag, Tag, primary_key: true
end
@doc false

View file

@ -7,11 +7,13 @@ defmodule Philomena.Tags.Tag do
index_name: "tags",
doc_type: "tag"
alias Philomena.Tags.Tag
schema "tags" do
belongs_to :aliased_tag, Philomena.Tags.Tag, source: :aliased_tag_id
has_many :aliases, Philomena.Tags.Tag, foreign_key: :aliased_tag_id
many_to_many :implied_tags, Philomena.Tags.Tag, join_through: "tags_implied_tags", join_keys: [tag_id: :id, implied_tag_id: :id]
many_to_many :implied_by_tags, Philomena.Tags.Tag, join_through: "tags_implied_tags", join_keys: [implied_tag_id: :id, tag_id: :id]
belongs_to :aliased_tag, Tag, source: :aliased_tag_id
has_many :aliases, Tag, foreign_key: :aliased_tag_id
many_to_many :implied_tags, Tag, join_through: "tags_implied_tags", join_keys: [tag_id: :id, implied_tag_id: :id]
many_to_many :implied_by_tags, Tag, join_through: "tags_implied_tags", join_keys: [implied_tag_id: :id, tag_id: :id]
field :slug, :string
field :name, :string

View file

@ -2,14 +2,19 @@ defmodule Philomena.Topics.Topic do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Forums.Forum
alias Philomena.Users.User
alias Philomena.Polls.Poll
alias Philomena.Posts.Post
@derive {Phoenix.Param, key: :slug}
schema "topics" do
belongs_to :user, Philomena.Users.User
belongs_to :deleted_by, Philomena.Users.User
belongs_to :locked_by, Philomena.Users.User
belongs_to :last_post, Philomena.Posts.Post
belongs_to :forum, Philomena.Forums.Forum
has_one :poll, Philomena.Polls.Poll
belongs_to :user, User
belongs_to :deleted_by, User
belongs_to :locked_by, User
belongs_to :last_post, Post
belongs_to :forum, Forum
has_one :poll, Poll
field :title, :string
field :post_count, :integer, default: 0

View file

@ -2,8 +2,10 @@ defmodule Philomena.UserFingerprints.UserFingerprint do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "user_fingerprints" do
belongs_to :user, Philomena.Users.User
belongs_to :user, User
field :fingerprint, :string
field :uses, :integer, default: 0

View file

@ -2,8 +2,10 @@ defmodule Philomena.UserIps.UserIp do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "user_ips" do
belongs_to :user, Philomena.Users.User
belongs_to :user, User
field :ip, EctoNetwork.INET
field :uses, :integer, default: 0

View file

@ -2,11 +2,14 @@ defmodule Philomena.UserLinks.UserLink do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
alias Philomena.Tags.Tag
schema "user_links" do
belongs_to :user, Philomena.Users.User
belongs_to :verified_by_user, Philomena.Users.User
belongs_to :contacted_by_user, Philomena.Users.User
belongs_to :tag, Philomena.Tags.Tag
belongs_to :user, User
belongs_to :verified_by_user, User
belongs_to :contacted_by_user, User
belongs_to :tag, Tag
field :aasm_state, :string
field :uri, :string

View file

@ -2,8 +2,10 @@ defmodule Philomena.UserNameChanges.UserNameChange do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "user_name_changes" do
belongs_to :user, Philomena.Users.User
belongs_to :user, User
field :name, :string
timestamps(inserted_at: :created_at)

View file

@ -2,8 +2,10 @@ defmodule Philomena.UserStatistics.UserStatistic do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "user_statistics" do
belongs_to :user, Philomena.Users.User
belongs_to :user, User
field :day, :integer, default: 0
field :uploads, :integer, default: 0
field :votes_cast, :integer, default: 0

View file

@ -2,7 +2,11 @@ defmodule Philomena.UserWhitelists.UserWhitelist do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
schema "user_whitelists" do
belongs_to :user, User
field :reason, :string
timestamps(inserted_at: :created_at)
end

View file

@ -2,11 +2,14 @@ defmodule Philomena.Users.Role do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Users.User
alias Philomena.Roles.Role
@primary_key false
schema "users_roles" do
belongs_to :user, Philomena.Users.User, primary_key: true
belongs_to :role, Philomena.Roles.Role, primary_key: true
belongs_to :user, User, primary_key: true
belongs_to :role, Role, primary_key: true
end
@doc false

View file

@ -13,19 +13,26 @@ defmodule Philomena.Users.User do
import Ecto.Changeset
alias Philomena.Filters.Filter
alias Philomena.UserLinks.UserLink
alias Philomena.Badges
alias Philomena.Notifications.UnreadNotification
alias Philomena.Galleries.Gallery
alias Philomena.Users.User
@derive {Phoenix.Param, key: :slug}
schema "users" do
has_many :links, Philomena.UserLinks.UserLink
has_many :verified_links, Philomena.UserLinks.UserLink, where: [aasm_state: "verified"]
has_many :public_links, Philomena.UserLinks.UserLink, where: [public: true, aasm_state: "verified"]
has_many :galleries, Philomena.Galleries.Gallery, foreign_key: :creator_id
has_many :awards, Philomena.Badges.Award
has_many :unread_notifications, Philomena.Notifications.UnreadNotification
has_many :links, UserLink
has_many :verified_links, UserLink, where: [aasm_state: "verified"]
has_many :public_links, UserLink, where: [public: true, aasm_state: "verified"]
has_many :galleries, Gallery, foreign_key: :creator_id
has_many :awards, Badges.Award
has_many :unread_notifications, UnreadNotification
has_many :notifications, through: [:unread_notifications, :notification]
belongs_to :current_filter, Philomena.Filters.Filter
belongs_to :deleted_by_user, Philomena.Users.User
belongs_to :current_filter, Filter
belongs_to :deleted_by_user, User
# Authentication
field :email, :string

View file

@ -58,7 +58,7 @@ defmodule Philomena.MixProject do
{:redix, "~> 0.10.2"},
{:bamboo, "~> 1.2"},
{:bamboo_smtp, "~> 1.7"},
{:remote_ip, "~> 0.1.5"}
{:remote_ip, "~> 0.2.0"}
]
end

View file

@ -49,7 +49,7 @@
"qrcode": {:hex, :qrcode, "0.1.5", "551271830515c150f34568345b060c625deb0e6691db2a01b0a6de3aafc93886", [:mix], [], "hexpm"},
"ranch": {:hex, :ranch, "1.7.1", "6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881", [:rebar3], [], "hexpm"},
"redix": {:hex, :redix, "0.10.2", "a9eabf47898aa878650df36194aeb63966d74f5bd69d9caa37babb32dbb93c5d", [:mix], [{:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"},
"remote_ip": {:hex, :remote_ip, "0.1.5", "0d8eb8a80387e196b0f48b3e7efb75525d1097cdb0ec70a4c69dd2ce9237c16c", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:inet_cidr, "~> 1.0", [hex: :inet_cidr, repo: "hexpm", optional: false]}, {:plug, "~> 1.2", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"remote_ip": {:hex, :remote_ip, "0.2.0", "6a40b87bc06fb33c71e423e4f2cdc76e45d42326508b4f9aaef6ff576190443d", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:inet_cidr, "~> 1.0", [hex: :inet_cidr, repo: "hexpm", optional: false]}, {:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"retry": {:hex, :retry, "0.13.0", "bb9b2713f70f39337837852337ad280c77662574f4fb852a8386c269f3d734c4", [:mix], [], "hexpm"},
"scrivener": {:hex, :scrivener, "2.7.0", "fa94cdea21fad0649921d8066b1833d18d296217bfdf4a5389a2f45ee857b773", [:mix], [], "hexpm"},
"scrivener_ecto": {:hex, :scrivener_ecto, "2.2.0", "53d5f1ba28f35f17891cf526ee102f8f225b7024d1cdaf8984875467158c9c5e", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:scrivener, "~> 2.4", [hex: :scrivener, repo: "hexpm", optional: false]}], "hexpm"},

View file

@ -0,0 +1,62 @@
defmodule Philomena.ImageFavesTest do
use Philomena.DataCase
alias Philomena.ImageFaves
describe "image_faves" do
alias Philomena.ImageFaves.ImageFave
@valid_attrs %{}
@update_attrs %{}
@invalid_attrs %{}
def image_fave_fixture(attrs \\ %{}) do
{:ok, image_fave} =
attrs
|> Enum.into(@valid_attrs)
|> ImageFaves.create_image_fave()
image_fave
end
test "list_image_faves/0 returns all image_faves" do
image_fave = image_fave_fixture()
assert ImageFaves.list_image_faves() == [image_fave]
end
test "get_image_fave!/1 returns the image_fave with given id" do
image_fave = image_fave_fixture()
assert ImageFaves.get_image_fave!(image_fave.id) == image_fave
end
test "create_image_fave/1 with valid data creates a image_fave" do
assert {:ok, %ImageFave{} = image_fave} = ImageFaves.create_image_fave(@valid_attrs)
end
test "create_image_fave/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = ImageFaves.create_image_fave(@invalid_attrs)
end
test "update_image_fave/2 with valid data updates the image_fave" do
image_fave = image_fave_fixture()
assert {:ok, %ImageFave{} = image_fave} = ImageFaves.update_image_fave(image_fave, @update_attrs)
end
test "update_image_fave/2 with invalid data returns error changeset" do
image_fave = image_fave_fixture()
assert {:error, %Ecto.Changeset{}} = ImageFaves.update_image_fave(image_fave, @invalid_attrs)
assert image_fave == ImageFaves.get_image_fave!(image_fave.id)
end
test "delete_image_fave/1 deletes the image_fave" do
image_fave = image_fave_fixture()
assert {:ok, %ImageFave{}} = ImageFaves.delete_image_fave(image_fave)
assert_raise Ecto.NoResultsError, fn -> ImageFaves.get_image_fave!(image_fave.id) end
end
test "change_image_fave/1 returns a image_fave changeset" do
image_fave = image_fave_fixture()
assert %Ecto.Changeset{} = ImageFaves.change_image_fave(image_fave)
end
end
end

View file

@ -0,0 +1,62 @@
defmodule Philomena.ImageFeaturesTest do
use Philomena.DataCase
alias Philomena.ImageFeatures
describe "image_features" do
alias Philomena.ImageFeatures.ImageFeature
@valid_attrs %{}
@update_attrs %{}
@invalid_attrs %{}
def image_feature_fixture(attrs \\ %{}) do
{:ok, image_feature} =
attrs
|> Enum.into(@valid_attrs)
|> ImageFeatures.create_image_feature()
image_feature
end
test "list_image_features/0 returns all image_features" do
image_feature = image_feature_fixture()
assert ImageFeatures.list_image_features() == [image_feature]
end
test "get_image_feature!/1 returns the image_feature with given id" do
image_feature = image_feature_fixture()
assert ImageFeatures.get_image_feature!(image_feature.id) == image_feature
end
test "create_image_feature/1 with valid data creates a image_feature" do
assert {:ok, %ImageFeature{} = image_feature} = ImageFeatures.create_image_feature(@valid_attrs)
end
test "create_image_feature/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = ImageFeatures.create_image_feature(@invalid_attrs)
end
test "update_image_feature/2 with valid data updates the image_feature" do
image_feature = image_feature_fixture()
assert {:ok, %ImageFeature{} = image_feature} = ImageFeatures.update_image_feature(image_feature, @update_attrs)
end
test "update_image_feature/2 with invalid data returns error changeset" do
image_feature = image_feature_fixture()
assert {:error, %Ecto.Changeset{}} = ImageFeatures.update_image_feature(image_feature, @invalid_attrs)
assert image_feature == ImageFeatures.get_image_feature!(image_feature.id)
end
test "delete_image_feature/1 deletes the image_feature" do
image_feature = image_feature_fixture()
assert {:ok, %ImageFeature{}} = ImageFeatures.delete_image_feature(image_feature)
assert_raise Ecto.NoResultsError, fn -> ImageFeatures.get_image_feature!(image_feature.id) end
end
test "change_image_feature/1 returns a image_feature changeset" do
image_feature = image_feature_fixture()
assert %Ecto.Changeset{} = ImageFeatures.change_image_feature(image_feature)
end
end
end

View file

@ -0,0 +1,62 @@
defmodule Philomena.ImageHidesTest do
use Philomena.DataCase
alias Philomena.ImageHides
describe "image_hides" do
alias Philomena.ImageHides.ImageHide
@valid_attrs %{}
@update_attrs %{}
@invalid_attrs %{}
def image_hide_fixture(attrs \\ %{}) do
{:ok, image_hide} =
attrs
|> Enum.into(@valid_attrs)
|> ImageHides.create_image_hide()
image_hide
end
test "list_image_hides/0 returns all image_hides" do
image_hide = image_hide_fixture()
assert ImageHides.list_image_hides() == [image_hide]
end
test "get_image_hide!/1 returns the image_hide with given id" do
image_hide = image_hide_fixture()
assert ImageHides.get_image_hide!(image_hide.id) == image_hide
end
test "create_image_hide/1 with valid data creates a image_hide" do
assert {:ok, %ImageHide{} = image_hide} = ImageHides.create_image_hide(@valid_attrs)
end
test "create_image_hide/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = ImageHides.create_image_hide(@invalid_attrs)
end
test "update_image_hide/2 with valid data updates the image_hide" do
image_hide = image_hide_fixture()
assert {:ok, %ImageHide{} = image_hide} = ImageHides.update_image_hide(image_hide, @update_attrs)
end
test "update_image_hide/2 with invalid data returns error changeset" do
image_hide = image_hide_fixture()
assert {:error, %Ecto.Changeset{}} = ImageHides.update_image_hide(image_hide, @invalid_attrs)
assert image_hide == ImageHides.get_image_hide!(image_hide.id)
end
test "delete_image_hide/1 deletes the image_hide" do
image_hide = image_hide_fixture()
assert {:ok, %ImageHide{}} = ImageHides.delete_image_hide(image_hide)
assert_raise Ecto.NoResultsError, fn -> ImageHides.get_image_hide!(image_hide.id) end
end
test "change_image_hide/1 returns a image_hide changeset" do
image_hide = image_hide_fixture()
assert %Ecto.Changeset{} = ImageHides.change_image_hide(image_hide)
end
end
end

View file

@ -0,0 +1,62 @@
defmodule Philomena.ImageIntensitiesTest do
use Philomena.DataCase
alias Philomena.ImageIntensities
describe "image_intensities" do
alias Philomena.ImageIntensities.ImageIntensity
@valid_attrs %{}
@update_attrs %{}
@invalid_attrs %{}
def image_intensity_fixture(attrs \\ %{}) do
{:ok, image_intensity} =
attrs
|> Enum.into(@valid_attrs)
|> ImageIntensities.create_image_intensity()
image_intensity
end
test "list_image_intensities/0 returns all image_intensities" do
image_intensity = image_intensity_fixture()
assert ImageIntensities.list_image_intensities() == [image_intensity]
end
test "get_image_intensity!/1 returns the image_intensity with given id" do
image_intensity = image_intensity_fixture()
assert ImageIntensities.get_image_intensity!(image_intensity.id) == image_intensity
end
test "create_image_intensity/1 with valid data creates a image_intensity" do
assert {:ok, %ImageIntensity{} = image_intensity} = ImageIntensities.create_image_intensity(@valid_attrs)
end
test "create_image_intensity/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = ImageIntensities.create_image_intensity(@invalid_attrs)
end
test "update_image_intensity/2 with valid data updates the image_intensity" do
image_intensity = image_intensity_fixture()
assert {:ok, %ImageIntensity{} = image_intensity} = ImageIntensities.update_image_intensity(image_intensity, @update_attrs)
end
test "update_image_intensity/2 with invalid data returns error changeset" do
image_intensity = image_intensity_fixture()
assert {:error, %Ecto.Changeset{}} = ImageIntensities.update_image_intensity(image_intensity, @invalid_attrs)
assert image_intensity == ImageIntensities.get_image_intensity!(image_intensity.id)
end
test "delete_image_intensity/1 deletes the image_intensity" do
image_intensity = image_intensity_fixture()
assert {:ok, %ImageIntensity{}} = ImageIntensities.delete_image_intensity(image_intensity)
assert_raise Ecto.NoResultsError, fn -> ImageIntensities.get_image_intensity!(image_intensity.id) end
end
test "change_image_intensity/1 returns a image_intensity changeset" do
image_intensity = image_intensity_fixture()
assert %Ecto.Changeset{} = ImageIntensities.change_image_intensity(image_intensity)
end
end
end

View file

@ -0,0 +1,62 @@
defmodule Philomena.ImageVotesTest do
use Philomena.DataCase
alias Philomena.ImageVotes
describe "image_votes" do
alias Philomena.ImageVotes.ImageVote
@valid_attrs %{}
@update_attrs %{}
@invalid_attrs %{}
def image_vote_fixture(attrs \\ %{}) do
{:ok, image_vote} =
attrs
|> Enum.into(@valid_attrs)
|> ImageVotes.create_image_vote()
image_vote
end
test "list_image_votes/0 returns all image_votes" do
image_vote = image_vote_fixture()
assert ImageVotes.list_image_votes() == [image_vote]
end
test "get_image_vote!/1 returns the image_vote with given id" do
image_vote = image_vote_fixture()
assert ImageVotes.get_image_vote!(image_vote.id) == image_vote
end
test "create_image_vote/1 with valid data creates a image_vote" do
assert {:ok, %ImageVote{} = image_vote} = ImageVotes.create_image_vote(@valid_attrs)
end
test "create_image_vote/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = ImageVotes.create_image_vote(@invalid_attrs)
end
test "update_image_vote/2 with valid data updates the image_vote" do
image_vote = image_vote_fixture()
assert {:ok, %ImageVote{} = image_vote} = ImageVotes.update_image_vote(image_vote, @update_attrs)
end
test "update_image_vote/2 with invalid data returns error changeset" do
image_vote = image_vote_fixture()
assert {:error, %Ecto.Changeset{}} = ImageVotes.update_image_vote(image_vote, @invalid_attrs)
assert image_vote == ImageVotes.get_image_vote!(image_vote.id)
end
test "delete_image_vote/1 deletes the image_vote" do
image_vote = image_vote_fixture()
assert {:ok, %ImageVote{}} = ImageVotes.delete_image_vote(image_vote)
assert_raise Ecto.NoResultsError, fn -> ImageVotes.get_image_vote!(image_vote.id) end
end
test "change_image_vote/1 returns a image_vote changeset" do
image_vote = image_vote_fixture()
assert %Ecto.Changeset{} = ImageVotes.change_image_vote(image_vote)
end
end
end

View file

@ -0,0 +1,62 @@
defmodule Philomena.SourceChangesTest do
use Philomena.DataCase
alias Philomena.SourceChanges
describe "source_changes" do
alias Philomena.SourceChanges.SourceChange
@valid_attrs %{}
@update_attrs %{}
@invalid_attrs %{}
def source_change_fixture(attrs \\ %{}) do
{:ok, source_change} =
attrs
|> Enum.into(@valid_attrs)
|> SourceChanges.create_source_change()
source_change
end
test "list_source_changes/0 returns all source_changes" do
source_change = source_change_fixture()
assert SourceChanges.list_source_changes() == [source_change]
end
test "get_source_change!/1 returns the source_change with given id" do
source_change = source_change_fixture()
assert SourceChanges.get_source_change!(source_change.id) == source_change
end
test "create_source_change/1 with valid data creates a source_change" do
assert {:ok, %SourceChange{} = source_change} = SourceChanges.create_source_change(@valid_attrs)
end
test "create_source_change/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = SourceChanges.create_source_change(@invalid_attrs)
end
test "update_source_change/2 with valid data updates the source_change" do
source_change = source_change_fixture()
assert {:ok, %SourceChange{} = source_change} = SourceChanges.update_source_change(source_change, @update_attrs)
end
test "update_source_change/2 with invalid data returns error changeset" do
source_change = source_change_fixture()
assert {:error, %Ecto.Changeset{}} = SourceChanges.update_source_change(source_change, @invalid_attrs)
assert source_change == SourceChanges.get_source_change!(source_change.id)
end
test "delete_source_change/1 deletes the source_change" do
source_change = source_change_fixture()
assert {:ok, %SourceChange{}} = SourceChanges.delete_source_change(source_change)
assert_raise Ecto.NoResultsError, fn -> SourceChanges.get_source_change!(source_change.id) end
end
test "change_source_change/1 returns a source_change changeset" do
source_change = source_change_fixture()
assert %Ecto.Changeset{} = SourceChanges.change_source_change(source_change)
end
end
end

View file

@ -0,0 +1,62 @@
defmodule Philomena.TagChangesTest do
use Philomena.DataCase
alias Philomena.TagChanges
describe "tag_changes" do
alias Philomena.TagChanges.TagChange
@valid_attrs %{}
@update_attrs %{}
@invalid_attrs %{}
def tag_change_fixture(attrs \\ %{}) do
{:ok, tag_change} =
attrs
|> Enum.into(@valid_attrs)
|> TagChanges.create_tag_change()
tag_change
end
test "list_tag_changes/0 returns all tag_changes" do
tag_change = tag_change_fixture()
assert TagChanges.list_tag_changes() == [tag_change]
end
test "get_tag_change!/1 returns the tag_change with given id" do
tag_change = tag_change_fixture()
assert TagChanges.get_tag_change!(tag_change.id) == tag_change
end
test "create_tag_change/1 with valid data creates a tag_change" do
assert {:ok, %TagChange{} = tag_change} = TagChanges.create_tag_change(@valid_attrs)
end
test "create_tag_change/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = TagChanges.create_tag_change(@invalid_attrs)
end
test "update_tag_change/2 with valid data updates the tag_change" do
tag_change = tag_change_fixture()
assert {:ok, %TagChange{} = tag_change} = TagChanges.update_tag_change(tag_change, @update_attrs)
end
test "update_tag_change/2 with invalid data returns error changeset" do
tag_change = tag_change_fixture()
assert {:error, %Ecto.Changeset{}} = TagChanges.update_tag_change(tag_change, @invalid_attrs)
assert tag_change == TagChanges.get_tag_change!(tag_change.id)
end
test "delete_tag_change/1 deletes the tag_change" do
tag_change = tag_change_fixture()
assert {:ok, %TagChange{}} = TagChanges.delete_tag_change(tag_change)
assert_raise Ecto.NoResultsError, fn -> TagChanges.get_tag_change!(tag_change.id) end
end
test "change_tag_change/1 returns a tag_change changeset" do
tag_change = tag_change_fixture()
assert %Ecto.Changeset{} = TagChanges.change_tag_change(tag_change)
end
end
end