41 lines
995 B
Elixir
41 lines
995 B
Elixir
defmodule Schema.Post do
|
|
@moduledoc false
|
|
use Schema
|
|
|
|
@derive {
|
|
Flop.Schema,
|
|
filterable: [],
|
|
sortable: [:published_at, :inserted_at, :updated_at, :id],
|
|
pagination_types: [:first, :last],
|
|
default_order: %{
|
|
order_by: [:published_at, :inserted_at, :updated_at, :id],
|
|
order_directions: [:desc, :desc, :desc, :desc]
|
|
},
|
|
default_pagination_type: :first,
|
|
default_limit: 20,
|
|
max_limit: 50
|
|
}
|
|
|
|
@post_kinds ~w[status blog]a
|
|
|
|
schema "posts" do
|
|
field :tid, :string
|
|
field :kind, Ecto.Enum, values: @post_kinds
|
|
field :slug, :string
|
|
field :title, :string
|
|
field :body, :string
|
|
|
|
field :published_at, :utc_datetime_usec
|
|
field :deleted_at, :utc_datetime_usec
|
|
|
|
field :syndicate_to_mastodon, :boolean, default: true
|
|
field :syndicate_to_bluesky, :boolean, default: true
|
|
|
|
has_one :mastodon_post, Schema.MastodonPost
|
|
has_one :bluesky_post, Schema.BlueskyPost
|
|
|
|
timestamps()
|
|
end
|
|
|
|
def kinds, do: @post_kinds
|
|
end
|