update repos

This commit is contained in:
Álvaro 2024-05-04 01:12:44 +02:00
parent 54289237be
commit 84589d6d7a
2 changed files with 11 additions and 1 deletions

View File

@ -8,6 +8,11 @@ defmodule LolAnalytics.Match.MatchRepo do
LoLAnalytics.Repo.all(query)
end
def number_of_matches do
query = from m in MatchSchema, select: count(m.match_id)
LoLAnalytics.Repo.one(query)
end
@spec get_match(String.t()) :: %LolAnalytics.Match.MatchSchema{}
def get_match(match_id) do
query = from m in MatchSchema, where: m.match_id == ^match_id

View File

@ -4,10 +4,15 @@ defmodule LolAnalytics.Player.PlayerRepo do
import Ecto.Query
def list_players do
query = from(p in PlayerSchema)
query = from p in PlayerSchema, order_by: [desc: p.id]
LoLAnalytics.Repo.all(query)
end
def number_of_players do
query = from p in PlayerSchema, select: count(p.id)
LoLAnalytics.Repo.one(query)
end
def get_player(puuid) do
query = from p in PlayerSchema, where: p.puuid == ^puuid
LoLAnalytics.Repo.one(query)