This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExKeyCDN.MixProject do | |
use Mix.Project | |
def project do | |
[ | |
app: :exkeycdn, | |
version: "0.0.2", | |
elixir: "~> 1.11", | |
start_permanent: Mix.env() == :prod, | |
deps: deps(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- | |
! Excerpted from "Programming Elm", | |
! published by The Pragmatic Bookshelf. | |
! Copyrights apply to this code. It may not be used to create training material, | |
! courses, books, articles, and the like. Contact us if you are in doubt. | |
! We make no guarantees that this code is fit for any purpose. | |
! Visit http://www.pragmaticprogrammer.com/titles/jfelm for more book information. | |
--> | |
<html lang="en"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- | |
! Excerpted from "Programming Elm", | |
! published by The Pragmatic Bookshelf. | |
! Copyrights apply to this code. It may not be used to create training material, | |
! courses, books, articles, and the like. Contact us if you are in doubt. | |
! We make no guarantees that this code is fit for any purpose. | |
! Visit http://www.pragmaticprogrammer.com/titles/jfelm for more book information. | |
--> | |
<html lang="en"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port module WebSocket exposing (listen, receive) | |
port listen : String -> Cmd msg | |
port receive : (String -> msg) -> Sub msg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@spec author_query() :: Ecto.Query.t() | |
def author_query() do | |
from user in User, | |
select: [:name, :email] | |
end | |
@spec query_active_charter_sessions(integer(), NaiveDateTime.t()) :: Ecto.Query.t() | |
def query_active_charter_sessions(charter_id, active_threshold) do | |
from(s in Session, | |
join: c in Charter, | |
on: c.id == s.charter_id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@spec query_active_charter_sessions(integer(), NaiveDateTime.t()) :: Ecto.Query.t() | |
def query_active_charter_sessions(charter_id, active_threshold) do | |
from(s in Session, | |
join: c in Charter, | |
on: c.id == s.charter_id, | |
where: c.id == ^charter_id, | |
where: ^active_threshold <= s.inserted_at, | |
preload: :author | |
) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@timestamps_opts [type: :utc_datetime] | |
schema "sessions" do | |
belongs_to(:charter, Charter) | |
has_many(:note, Note) | |
has_one(:report, Report) | |
belongs_to(:author, User) | |
timestamps() | |
end |