This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| web_1 | ** (EXIT from #PID<0.49.0>) an exception was raised: | |
| web_1 | ** (FunctionClauseError) no function clause matching in Regex.match?/2 | |
| web_1 | (elixir) lib/regex.ex:157: Regex.match?(~r/^\/([^\/])+$/, nil) | |
| web_1 | (ecto) lib/ecto/repo/supervisor.ex:85: Ecto.Repo.Supervisor.parse_url/1 | |
| web_1 | (ecto) lib/ecto/repo/supervisor.ex:21: Ecto.Repo.Supervisor.config/3 | |
| web_1 | (ecto) lib/ecto/repo/supervisor.ex:107: Ecto.Repo.Supervisor.init/1 | |
| web_1 | (stdlib) supervisor.erl:272: :supervisor.init/1 | |
| web_1 | (stdlib) gen_server.erl:328: :gen_server.init_it/6 | |
| web_1 | (stdlib) proc_lib.erl:239: :proc_lib.init_p_do_apply/3 | |
| web_1 | 10:22:24.968 [info] Running Mobil.Endpoint with Cowboy on http://example.com:4000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # prod.ex | |
| config :mobil, Mobil.Endpoint, | |
| secret_key_base: System.get_env("PHOENIX_SECRET") | |
| # Finally import the config/prod.secret.exs | |
| # which should be versioned separately. | |
| config :mobil, Mobil.Repo, | |
| adapter: Ecto.Adapters.Postgres, | |
| host: "db", | |
| username: "postgres", #System.get_env("DB_ENV_user"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The idea is to add support for something like. | |
| # query = from s in Subscription, | |
| # order_by: s.price + s.registration_fee | |
| # | |
| # subscriptions = Repo.all(query) | |
| # Arithmetic | |
| def escape({operator, _, [left, right]} = expr, type, params, vars, env) when operator in ~w(+ - * /)a do | |
| ltype = quoted_type(right, vars) | |
| rtype = quoted_type(left, vars) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Find all assignments & views. | |
| var assignments = App.__container__.lookup('store:main').all("assignment"); | |
| var views = App.__container__.lookup("component:assignment-frame")._viewRegistry; | |
| $.each(views, function(i, view) { | |
| // If the view is empty, or does not have a controller context, skip. | |
| if (view == null || view._controller.model == null) { | |
| return; | |
| } | |
| // Get the id controller context model. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # User has many storages. | |
| # | |
| # Give me a user, along with the storages it owns. | |
| # q={user(id: 131) {name, storages{title} }} | |
| defmodule Users.Types do | |
| use Absinthe.Schema.Notation | |
| object :user do | |
| field :id, :id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule ApiEndpoint.Schema.Helpers do | |
| def has_many({model, foreign_key}, ids) do | |
| import Ecto.Query | |
| model | |
| |> where([m], field(m, ^foreign_key) in ^ids) | |
| |> Storages.Repo.all | |
| |> Enum.group_by(fn storage -> Map.get(storage, foreign_key) end) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule ApiEndpoint.Endpoint do | |
| # .... | |
| plug Absinthe.Plug, | |
| schema: ApiEndpoint.Schema | |
| end | |
| defmodule ApiEndpoint.Router do | |
| forward "/api/v2", Absinthe.Plug, schema: ApiEndpoint.Schema | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmacro belongs_to(model) do | |
| [_ | module] = Module.split(unquote(model)) | |
| key = Macro.underscore(module) <> "_id" |> String.to_atom | |
| quote do | |
| ..... | |
| > belongs_to(Users.User) | |
| == Compilation error on file lib/storages/schemas/storage_schema.ex == | |
| ** (FunctionClauseError) no function clause matching in Module.split/1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule GraphqlHelpers do | |
| import Ecto.Query | |
| defmacro has_many(model, foreign_key) do | |
| quote do | |
| resolve fn subject, _, _ -> | |
| batch({GraphqlHelpers, :process_has_many, {unquote(model), unquote(foreign_key)}}, subject.id, fn (batch_result) -> | |
| {:ok, Map.get(batch_result, subject.id, %{})} | |
| end) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Users.Types do | |
| use Absinthe.Schema.Notation | |
| import GraphqlHelpers | |
| object :user do | |
| field :id, :id | |
| field :first_name, :string | |
| field :last_name, :string | |
| field :email, :string | |
| field :phone, :string |