Skip to content

Commit

Permalink
feat(post-draft): add initial model for post drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
akinsey committed Mar 7, 2024
1 parent 280ff29 commit bd43a1f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .iex.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ alias EpochtalkServer.Models.{
Notification,
Permission,
Post,
PostDraft,
Poll,
PollAnswer,
PollResponse,
Expand Down
29 changes: 29 additions & 0 deletions lib/epochtalk_server/models/post_draft.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
defmodule EpochtalkServer.Models.PostDraft do
use Ecto.Schema
# alias EpochtalkServer.Repo
alias EpochtalkServer.Models.User

@moduledoc """
`PostDraft` model, for performing actions relating to a `User`'s `Post` draft
"""
@type t :: %__MODULE__{
user_id: non_neg_integer | nil,
draft: String.t() | nil,
updated_at: NaiveDateTime.t() | nil
}
@derive {Jason.Encoder,
only: [
:user_id,
:draft,
:updated_at
]}
@schema_prefix "posts"
@primary_key false
schema "user_drafts" do
belongs_to :user, User
field :draft, :string
field :updated_at, :naive_datetime
end

## === Database Functions ===
end

0 comments on commit bd43a1f

Please sign in to comment.