Compare commits

..

5 Commits

Author SHA1 Message Date
f03037a943 add search to notes
Some checks are pending
continuous-integration/drone/push Build is pending
2022-11-18 23:45:24 -05:00
282d2b7664 remove transition all on input 2022-11-18 23:45:24 -05:00
3dbbb7e21c alias endpoint 2022-11-18 23:45:24 -05:00
b641e96601 display topbar when user is logged out 2022-11-18 23:45:24 -05:00
e0f0e39326 work on notes 2022-11-18 23:45:24 -05:00
2 changed files with 2 additions and 5 deletions

View File

@ -4,7 +4,7 @@ defmodule Memex.Notes.Note do
"""
use Ecto.Schema
import Ecto.Changeset
alias Ecto.{Changeset, UUID}
alias Ecto.UUID
alias Memex.{Accounts.User, Notes.Note}
@primary_key {:id, :binary_id, autogenerate: true}
@ -23,10 +23,8 @@ defmodule Memex.Notes.Note do
@type t :: %Note{}
@type id :: UUID.t()
@type changeset :: Changeset.t(t())
@doc false
@spec create_changeset(attrs :: map(), User.t()) :: changeset()
def create_changeset(attrs, %User{id: user_id}) do
%Note{}
|> cast(attrs, [:title, :content, :tags, :visibility])
@ -35,7 +33,6 @@ defmodule Memex.Notes.Note do
|> validate_required([:title, :content, :user_id, :visibility])
end
@spec update_changeset(Note.t(), attrs :: map(), User.t()) :: changeset()
def update_changeset(%{user_id: user_id} = note, attrs, %User{id: user_id}) do
note
|> cast(attrs, [:title, :content, :tags, :visibility])

View File

@ -3,7 +3,7 @@ defmodule MemexWeb.NoteLive.Index do
alias Memex.{Notes, Notes.Note}
@impl true
def mount(_params, _session, socket) do
def mount(params, _session, socket) do
{:ok, socket |> assign(search: nil) |> display_notes()}
end