feat(chat): validate and submit messages

This commit is contained in:
2024-10-24 17:21:49 +00:00
parent 6581aa3ba5
commit b2e04be7ec
3 changed files with 66 additions and 9 deletions

View File

@@ -16,7 +16,7 @@ defmodule Slax.Chat.Message do
@doc false
def changeset(message, attrs) do
message
|> cast(attrs, [:user_id, :room_id, :body])
|> validate_required([:user_id, :room_id, :body])
|> cast(attrs, [:body])
|> validate_required([:body])
end
end