New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post to groups #66
Post to groups #66
Conversation
lib/level/groups.ex
Outdated
@@ -194,4 +210,19 @@ defmodule Level.Groups do | |||
|> Ecto.Changeset.change(state: "CLOSED") | |||
|> Repo.update() | |||
end | |||
|
|||
@doc false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing you might consider here is using the @impl true
annotation (and in other places where you're implementing this behaviour). That's when you're specifying which functions are implementations of behaviour callbacks. You can read a bit more about @impl
in the 1.5 release notes: https://elixir-lang.org/blog/2017/07/25/elixir-v1-5-0-released/ and in the issue around its addition to the language: elixir-lang/elixir#5734
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤩 this is great!
def create_post(space_user, params) do | ||
@spec post_to_group(SpaceUser.t(), Group.t(), map()) :: post_to_group_result() | ||
def post_to_group(space_user, group, params) do | ||
Multi.new() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of Ecto.Multi
! Looks like all this Elixir-ing is paying off.
Fixes #64