more stuff
This commit is contained in:
parent
c1f9b008d1
commit
7b87fc61ce
3 changed files with 10 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
# Used by "mix format"
|
||||
[
|
||||
import_deps: [:ecto, :ecto_sql],
|
||||
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import Config
|
||||
|
||||
config :top_poster_server, TopPosterServer.Repo, database: :memory
|
||||
config :top_poster_server, TopPosterServer.Repo, database: "/tmp/wow.db"
|
||||
config :top_poster_server, ecto_repos: [TopPosterServer.Repo]
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ defmodule TopPosterServer.Plug do
|
|||
import Plug.Conn
|
||||
alias Plug.Conn
|
||||
|
||||
import Ecto.Query
|
||||
alias TopPosterServer.{Repo, User}
|
||||
|
||||
require Logger
|
||||
|
|
@ -23,8 +24,13 @@ defmodule TopPosterServer.Plug do
|
|||
conn
|
||||
|> send_resp(200, "valid id")
|
||||
else
|
||||
Repo.insert!(%User{discord_id: "354988989100589058", posts: 413})
|
||||
|
||||
query = from u in User, order_by: [desc: u.posts, asc: u.discord_id]
|
||||
users = Repo.all(query)
|
||||
|
||||
conn
|
||||
|> send_resp(200, "default page")
|
||||
|> send_resp(200, "default page #{inspect(users)}")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue