implement notes

This commit is contained in:
2022-11-17 22:38:52 -05:00
parent 0aa7df0b37
commit 1a508a42ef
21 changed files with 1096 additions and 574 deletions

View File

@ -3,20 +3,23 @@ defmodule Memex.NotesFixtures do
This module defines test helpers for creating
entities via the `Memex.Notes` context.
"""
alias Memex.{Accounts.User, Notes, Notes.Note}
@doc """
Generate a note.
"""
def note_fixture(attrs \\ %{}) do
@spec note_fixture(User.t()) :: Note.t()
@spec note_fixture(attrs :: map(), User.t()) :: Note.t()
def note_fixture(attrs \\ %{}, user) do
{:ok, note} =
attrs
|> Enum.into(%{
content: "some content",
tag: [],
title: "some title",
visibility: :public
visibility: :private
})
|> Memex.Notes.create_note()
|> Notes.create_note(user)
note
end