Skip to content

Commit

Permalink
feat: handle query parser export (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
pichoemr authored May 30, 2022
1 parent f6e4650 commit ed823be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
9 changes: 3 additions & 6 deletions apps/lenra/lib/lenra/services/data_service.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ defmodule Lenra.DataServices do
alias Lenra.Repo

alias ApplicationRunner.{
AST.EctoParser,
AST.Parser,
AST.Query,
Data,
DataQueryViewServices,
DataServices,
Expand Down Expand Up @@ -41,20 +38,20 @@ defmodule Lenra.DataServices do
[]
end

def exec_query(%Query{} = query, env_id, user_id) do
def exec_query(query, env_id, user_id) do
user_data =
env_id
|> ApplicationRunner.UserDataServices.current_user_data_query(user_id)
|> Repo.one()

query
|> EctoParser.to_ecto(env_id, user_data.id)
|> ApplicationRunner.DataServices.ecto_parser(env_id, user_data.id)
|> Repo.all()
end

def parse_and_exec_query(query, env_id, user_id) do
query
|> Parser.from_json()
|> ApplicationRunner.DataServices.json_parser()
|> exec_query(env_id, user_id)
end

Expand Down
2 changes: 1 addition & 1 deletion apps/lenra/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ defmodule Lenra.MixProject do
name: :application_runner,
host: "github.com",
project: "lenra-io/application-runner.git",
tag: "v1.0.0-beta.36",
tag: "v1.0.0-beta.37",
credentials: "shiipou:#{System.get_env("GH_PERSONNAL_TOKEN")}"
)
]
Expand Down
3 changes: 2 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%{
"application_runner": {:git, "git@github.com:lenra-io/application-runner.git", "e7b827ec2947e4e25585ba39203d8396d0c13b3f", [tag: "v1.0.0-beta.36", submodules: true]},
"application_runner": {:git, "git@github.com:lenra-io/application-runner.git", "2c18ce92b5c01c476637516a5b9da4392c1bb37e", [tag: "v1.0.0-beta.37", submodules: true]},
"argon2_elixir": {:hex, :argon2_elixir, "2.4.1", "edb27bdd326bc738f3e4614eddc2f73507be6fedc9533c6bcc6f15bbac9c85cc", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "0e21f52a373739d00bdfd5fe6da2f04eea623cb4f66899f7526dd9db03903d9f"},
"bamboo": {:hex, :bamboo, "2.1.0", "3c58f862efd74fa8c8d48a410ac592b41f7d24785e828566f7a0af549269ddc3", [:mix], [{:hackney, ">= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.4", [hex: :mime, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f0ad2623b9a1d2dc06dcf289b59df9ebc522f49f3a21971ec87a8fce04e6d33e"},
"bamboo_smtp": {:hex, :bamboo_smtp, "4.0.1", "7e48188663f6164a81183688bb263be4c3952648fcd3ce52164f44d68777f9cd", [:mix], [{:bamboo, "~> 2.1.0", [hex: :bamboo, repo: "hexpm", optional: false]}, {:gen_smtp, "~> 1.1.1", [hex: :gen_smtp, repo: "hexpm", optional: false]}], "hexpm", "7ff1d62ae39bfb1c14f6d3cddba0fa1482a45c2a2b497a2da601eff7099605c8"},
Expand Down Expand Up @@ -70,6 +70,7 @@
"plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"},
"poison": {:hex, :poison, "1.5.2", "560bdfb7449e3ddd23a096929fb9fc2122f709bcc758b2d5d5a5c7d0ea848910", [:mix], [], "hexpm", "4afc59dcadf71be7edc8b934b39f554ec7b31e2b1b1a4767383a663f86958ce3"},
"postgrex": {:hex, :postgrex, "0.15.13", "7794e697481799aee8982688c261901de493eb64451feee6ea58207d7266d54a", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "3ffb76e1a97cfefe5c6a95632a27ffb67f28871c9741fb585f9d1c3cd2af70f1"},
"query_parser": {:git, "git@github.com:lenra-io/query-parser.git", "e9a72b5ea2a3c0c0058d6473cb4ea6e76ba580c0", [tag: "v1.0.0-beta.1", submodules: true]},
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"sentry": {:hex, :sentry, "8.0.6", "c8de1bf0523bc120ec37d596c55260901029ecb0994e7075b0973328779ceef7", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.6", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, "~> 2.3", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "051a2d0472162f3137787c7c9d6e6e4ef239de9329c8c45b1f1bf1e9379e1883"},
"simplehttp": {:hex, :simplehttp, "0.5.1", "103d027c50398b1e2cf26329cd78d8cf55211c17d19e0bb258a7987fe8df3584", [:mix], [], "hexpm", "32a945235f59cdd6615478f143807f79416555559bf0a701971570628a6884f1"},
Expand Down

0 comments on commit ed823be

Please sign in to comment.