1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00

Merge pull request #18 from danbee/hound-will-probably-have-a-lot-to-say

Unleash the Hound! 🐕
This commit is contained in:
Daniel Barber 2018-02-20 15:25:30 -05:00 committed by GitHub
commit 00ff6ee218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 8 deletions

2
.hound.yml Normal file
View File

@ -0,0 +1,2 @@
credo:
enabled: true

View File

@ -1,4 +1,6 @@
defmodule Chess do
@moduledoc false
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html

View File

@ -105,10 +105,11 @@ defmodule Chess.Auth do
@doc false
def authenticate_user(username, password) do
Repo.one(
from u in User,
where: u.username == ^username
)
query = from u in User,
where: u.username == ^username
query
|> Repo.one
|> Argon2.check_pass(password)
end
end

View File

@ -1,4 +1,6 @@
defmodule Chess.Auth.Guardian do
@moduledoc false
use Guardian, otp_app: :chess
alias Chess.Auth

View File

@ -1,4 +1,6 @@
defmodule Chess.Board do
@moduledoc false
def output(board) do
Enum.map(0..7, fn (rank) ->
Enum.map(0..7, fn (file) ->

View File

@ -1,4 +1,6 @@
defmodule Chess.Store.Game do
@moduledoc false
use Ecto.Schema
use Timex.Ecto.Timestamps

View File

@ -5,10 +5,12 @@ defmodule ChessWeb.GameController do
def index(conn, _params) do
changeset = Game.changeset(%Game{})
games = Game
|> Game.for_user(current_user(conn))
|> Game.ordered
|> Repo.all
games =
Game
|> Game.for_user(current_user(conn))
|> Game.ordered
|> Repo.all
render(conn, "index.html", games: games, changeset: changeset)
end
@ -30,6 +32,7 @@ defmodule ChessWeb.GameController do
def show(conn, %{"id" => id}) do
game = Repo.get!(Game, id)
render(conn, "show.html", game: game)
end