Skip to content

Instantly share code, notes, and snippets.

View zacck-zz's full-sized avatar
Lemur Heavy

Zacck Osiemo zacck-zz

Lemur Heavy
View GitHub Profile
defmodule MenanaweApi.Auth.Policies do
@moduledoc """
This moudle holds changeset functions to deal with the policies
"""
alias MenanaweApi.{
Repo,
Auth.Policies.Policy,
Accounts.Profile
}

How we collaborate using branching

At LK when working on code we use modified version of the Git Workflow that is simply

Create a private branch off a public branch. Regularly commit your work to this private branch. Once your code is working, clean up its history. Merge the cleaned-up branch back into the public branch.

Default Branches

** (exit) exited in: GenServer.call(Ecto.Migration.Supervisor, {:start_child, [#PID<0.127.0>, HelloApi.Repo, :forward, :up, %{level: :info, sql: false}]}, :infinity)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
(elixir) lib/gen_server.ex:826: GenServer.call/3
(ecto_sql) lib/ecto/migration/runner.ex:22: Ecto.Migration.Runner.run/7
(ecto_sql) lib/ecto/migrator.ex:196: Ecto.Migrator.attempt/7
(ecto_sql) lib/ecto/migrator.ex:113: anonymous fn/4 in Ecto.Migrator.do_up/4
(ecto_sql) lib/ecto/adapters/sql.ex:784: anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4
(db_connection) lib/db_connection.ex:1341: DBConnection.run_transaction/4
(ecto_sql) lib/ecto/migrator.ex:184: Ecto.Migrator.do_run_maybe_in_transaction/3
(elixir) lib/task/supervised.ex:88: Task.Supervised.do_apply/2
# first error
** (MatchError) no match of right hand side value: {:error, #Ecto.Changeset<action: :insert, changes: %{in_months: 36,
business_name: "Little Kidogo", cell_number: "1233438080", email: "[email protected]", first_name: "Zacck", industry_id: 42,
last_name: "Osiemo", monthly_revenue: #Decimal<100000>, password: "18y7391heqiuhr2iurebqubd2", ssn_last_4: "4567"},
errors: [laser_score: {"is invalid", [type: LaserRange, validation: :cast]}], data: .User<>, valid?: false>}
# second error
** (DBConnection.EncodeError) Postgrex expected a list, got %Postgrex.Range{lower: 499, lower_inclusive: true,
defmodule LaserRange do
@moduledoc """
This module holds the implementation for the `LaserRange`
It implements an `Ecto.Type` behaviour
"""
@behaviour Ecto.Type
@doc false
@spec type() :: tuple()
function fetchMenuItems() {
return window.fetch('http://localhost:4000/api', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: '{ menuItems { name } }'
})
})
import Browser
import Browser.Navigation as Nav
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
import Url
import Route exposing(Route)
import Session exposing(Session)
import Page exposing(Page)
import Page.Landing as Landing
subscribe : SelectionSet response RootSubscription -> Session -> Cmd msg
subscribe query session =
let
headers : List ( String, String )
headers =
[ ( "authorization", JWT.authorizationHeader session.jwt )
]
queryString : String
queryString =
{
"countries": [
"US"
],
"criteriaSets": [
{
"id": {
"validationRegExp": "(X)-.+",
"required": true
}

User-Agent: DiscordBot ($url, $versionNumber)