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:
commit
00ff6ee218
2
.hound.yml
Normal file
2
.hound.yml
Normal file
@ -0,0 +1,2 @@
|
||||
credo:
|
||||
enabled: true
|
||||
@ -1,4 +1,6 @@
|
||||
defmodule Chess do
|
||||
@moduledoc false
|
||||
|
||||
use Application
|
||||
|
||||
# See http://elixir-lang.org/docs/stable/elixir/Application.html
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
defmodule Chess.Auth.Guardian do
|
||||
@moduledoc false
|
||||
|
||||
use Guardian, otp_app: :chess
|
||||
|
||||
alias Chess.Auth
|
||||
|
||||
@ -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) ->
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
defmodule Chess.Store.Game do
|
||||
@moduledoc false
|
||||
|
||||
use Ecto.Schema
|
||||
use Timex.Ecto.Timestamps
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user