Skip to content
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

fix failing ci error and inc develop vsn #98

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/twinklyhaha_web/controllers/oc2_controller.ex
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
defmodule TwinklyhahaWeb.OC2Controller do
require Logger
use TwinklyhahaWeb, :controller
alias Openc2.Oc2.Command

@topic "leds"

def command(conn, params) do
params
|> Jason.encode!()
|> Openc2.Oc2.Command.new()
|> Openc2.Oc2.Command.do_cmd()
|> Command.new()
|> Command.do_cmd()
|> handle_response(conn)
end

defp handle_response(%Openc2.Oc2.Command{target: nil}, conn) do
defp handle_response(%Command{target: nil}, conn) do
send_resp(conn, :unprocessable_entity, "Oops! no target?")
end

defp handle_response(%Openc2.Oc2.Command{target: command}, conn) do
defp handle_response(%Command{target: command}, conn) do
Phoenix.PubSub.broadcast(Twinklyhaha.PubSub, @topic, command)
json(conn, %{status: :ok})
end
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Twinklyhaha.MixProject do
def project do
[
app: :twinklyhaha,
version: "0.5.1",
version: "0.5.2",
elixir: "~> 1.15.6",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),
Expand Down
Loading