commit 4315899ddde2247aa6b05e6f4dc9b062f339b25c
parent e19f32986522e47e742a259b4c194c5ede77d803
Author: srfsh <dev@srf.sh>
Date: Tue, 26 Jul 2022 17:24:41 +0300
Zenflows.Keypairoom: init
Diffstat:
3 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/src/zenflows/keypairoom/domain.ex b/src/zenflows/keypairoom/domain.ex
@@ -0,0 +1,29 @@
+# Zenflows is designed to implement the Valueflows vocabulary,
+# written and maintained by srfsh <info@dyne.org>.
+# Copyright (C) 2021-2022 Dyne.org foundation <foundation@dyne.org>.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+defmodule Zenflows.Keypairoom.Domain do
+@moduledoc """
+Domain logic of interacting with Restroom to do Keypairoom-related
+tasks.
+"""
+
+alias Zenflows.Restroom
+
+def keypairoom_server(data) do
+ Restroom.keypairoom_server(data)
+end
+end
diff --git a/src/zenflows/keypairoom/resolv.ex b/src/zenflows/keypairoom/resolv.ex
@@ -0,0 +1,35 @@
+# Zenflows is designed to implement the Valueflows vocabulary,
+# written and maintained by srfsh <info@dyne.org>.
+# Copyright (C) 2021-2022 Dyne.org foundation <foundation@dyne.org>.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+defmodule Zenflows.Keypairoom.Resolv do
+@moduledoc "Resolvers of keypairoom-related queries."
+
+require Logger
+
+alias Zenflows.Keypairoom.Domain
+
+def keypairoom_server(%{user_data: data}, _) do
+ case Domain.keypairoom_server(data) do
+ {:ok, value} ->
+ {:ok, value}
+
+ {:error, reason} ->
+ Logger.debug(reason)
+ {:error, "something went wrong"}
+ end
+end
+end
diff --git a/src/zenflows/keypairoom/type.ex b/src/zenflows/keypairoom/type.ex
@@ -0,0 +1,34 @@
+# Zenflows is designed to implement the Valueflows vocabulary,
+# written and maintained by srfsh <info@dyne.org>.
+# Copyright (C) 2021-2022 Dyne.org foundation <foundation@dyne.org>.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+defmodule Zenflows.Keypairoom.Type do
+@moduledoc "GraphQL types of Keypairoom."
+
+use Absinthe.Schema.Notation
+
+alias Zenflows.Keypairoom.Resolv
+
+object :mutation_keypairoom do
+ field :keypairoom_server, non_null(:string) do
+ meta only_guest?: true
+
+ @desc "A JSON object encoded as Base64 string."
+ arg :user_data, non_null(:string)
+ resolve &Resolv.keypairoom_server/2
+ end
+end
+end