Skip to content

Commit 62cc6e8

Browse files
Initial commit
0 parents  commit 62cc6e8

21 files changed

+328
-0
lines changed

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps
9+
10+
# Where 3rd-party dependencies like ExDoc output generated docs.
11+
/doc
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
/config/prod.exs
23+
/config/dev.exs

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Slacklog
2+
3+
**TODO: Add description**
4+
5+
## Installation
6+
7+
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
8+
by adding `slacklog` to your list of dependencies in `mix.exs`:
9+
10+
```elixir
11+
def deps do
12+
[{:slacklog, "~> 0.1.0"}]
13+
end
14+
```
15+
16+
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
17+
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
18+
be found at [https://hexdocs.pm/slacklog](https://hexdocs.pm/slacklog).
19+

config/config.exs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This file is responsible for configuring your application
2+
# and its dependencies with the aid of the Mix.Config module.
3+
use Mix.Config
4+
5+
# This configuration is loaded before any dependency and is restricted
6+
# to this project. If another project depends on this project, this
7+
# file won't be loaded nor affect the parent project. For this reason,
8+
# if you want to provide default values for your application for
9+
# 3rd-party users, it should be done in your "mix.exs" file.
10+
11+
# You can configure for your application as:
12+
#
13+
# config :slacklog, key: :value
14+
#
15+
# And access this configuration in your application as:
16+
#
17+
# Application.get_env(:slacklog, :key)
18+
#
19+
# Or configure a 3rd-party app:
20+
#
21+
# config :logger, level: :info
22+
#
23+
24+
config :slacklog, ecto_repos: [Slacklog.Repo]
25+
26+
27+
# It is also possible to import configuration files, relative to this
28+
# directory. For example, you can emulate configuration per environment
29+
# by uncommenting the line below and defining dev.exs, test.exs and such.
30+
# Configuration from the imported file will override the ones defined
31+
# here (which is why it is important to import them last).
32+
#
33+
# import_config "#{Mix.env}.exs"
34+
35+
import_config "#{Mix.env}.exs"

config/dev.sample.exs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use Mix.Config
2+
3+
config :slacklog, Slacklog.Repo,
4+
adapter: Ecto.Adapters.Postgres,
5+
database: "slacklog_dev",
6+
username: "postgres",
7+
password: "postgres",
8+
hostname: "localhost",
9+
pool_size: 10

config/prod.sample.exs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use Mix.Config
2+
3+
config :slacklog, Slacklog.Repo,
4+
adapter: Ecto.Adapters.Postgres,
5+
database: "slacklog_prod",
6+
username: "postgres",
7+
password: "postgres",
8+
hostname: "localhost",
9+
pool_size: 20

lib/slacklog.ex

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
defmodule Slacklog do
2+
@moduledoc """
3+
Documentation for Slacklog.
4+
"""
5+
6+
@doc """
7+
Hello world.
8+
9+
## Examples
10+
11+
iex> Slacklog.hello
12+
:world
13+
14+
"""
15+
def hello do
16+
:world
17+
end
18+
end

lib/slacklog/application.ex

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
defmodule Slacklog.Application do
2+
# See http://elixir-lang.org/docs/stable/elixir/Application.html
3+
# for more information on OTP Applications
4+
@moduledoc false
5+
6+
use Application
7+
8+
def start(_type, _args) do
9+
import Supervisor.Spec, warn: false
10+
11+
# Define workers and child supervisors to be supervised
12+
children = [
13+
# Starts a worker by calling: Slacklog.Worker.start_link(arg1, arg2, arg3)
14+
# worker(Slacklog.Worker, [arg1, arg2, arg3]),
15+
supervisor(Slacklog.Repo, [])
16+
]
17+
18+
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
19+
# for other strategies and supported options
20+
opts = [strategy: :one_for_one, name: Slacklog.Supervisor]
21+
Supervisor.start_link(children, opts)
22+
end
23+
end

lib/slacklog/logs/channel.ex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
defmodule Slacklog.Logs.Channel do
2+
use Ecto.Schema
3+
4+
@primary_key {:id, :string, []}
5+
6+
schema "channels" do
7+
has_many :messages, Slacklog.Logs.Message
8+
has_many :pins, Slacklog.Logs.Pin
9+
10+
timestamps()
11+
end
12+
13+
end

lib/slacklog/logs/message.ex

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
defmodule Slacklog.Logs.Message do
2+
use Ecto.Schema
3+
4+
@primary_key {:id, :string, []}
5+
6+
schema "messages" do
7+
field :text, :string
8+
9+
belongs_to :channel, Slacklog.Logs.Channel, type: :string
10+
has_one :pin, Slacklog.Logs.Pin
11+
12+
timestamps()
13+
end
14+
15+
end

lib/slacklog/logs/pin.ex

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
defmodule Slacklog.Logs.Pin do
2+
use Ecto.Schema
3+
4+
schema "pins" do
5+
belongs_to :message, Slacklog.Logs.Message, type: :string
6+
belongs_to :channel, Slacklog.Logs.Channel, type: :string
7+
8+
timestamps()
9+
end
10+
11+
end

0 commit comments

Comments
 (0)