update
This commit is contained in:
parent
e2967f68b2
commit
ef2a6c41b4
39 changed files with 2349 additions and 30 deletions
20
lib/zoeyscomputer/images/image.ex
Normal file
20
lib/zoeyscomputer/images/image.ex
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
defmodule Zoeyscomputer.Images.Image do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
@derive {Jason.Encoder, only: [:id, :file, :inserted_at, :updated_at]}
|
||||
|
||||
schema "images" do
|
||||
field(:file, :string)
|
||||
belongs_to :user, Zoeyscomputer.Users.User
|
||||
|
||||
timestamps(type: :utc_datetime)
|
||||
end
|
||||
|
||||
@doc false
|
||||
def changeset(image, attrs) do
|
||||
image
|
||||
|> cast(attrs, [:file, :user_id])
|
||||
|> validate_required([:file, :user_id])
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue