api specs
This commit is contained in:
4
phoenix/priv/repo/migrations/.formatter.exs
Normal file
4
phoenix/priv/repo/migrations/.formatter.exs
Normal file
@@ -0,0 +1,4 @@
|
||||
[
|
||||
import_deps: [:ecto_sql],
|
||||
inputs: ["*.exs"]
|
||||
]
|
||||
@@ -0,0 +1,92 @@
|
||||
defmodule ShootingEventPhx.Repo.Migrations.InitEventSchema do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
execute("""
|
||||
CREATE TABLE IF NOT EXISTS players (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name_ar TEXT NOT NULL,
|
||||
name_en TEXT NOT NULL,
|
||||
group_code TEXT NOT NULL DEFAULT '',
|
||||
image_data TEXT NOT NULL DEFAULT '',
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
""")
|
||||
|
||||
execute("""
|
||||
CREATE TABLE IF NOT EXISTS scores (
|
||||
stage TEXT NOT NULL,
|
||||
player_id INTEGER NOT NULL,
|
||||
score INTEGER NOT NULL DEFAULT 0,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(stage, player_id),
|
||||
FOREIGN KEY(player_id) REFERENCES players(id) ON DELETE CASCADE
|
||||
);
|
||||
""")
|
||||
|
||||
execute("""
|
||||
CREATE TABLE IF NOT EXISTS score_attachments (
|
||||
stage TEXT NOT NULL,
|
||||
player_id INTEGER NOT NULL,
|
||||
image_data TEXT NOT NULL DEFAULT '',
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(stage, player_id),
|
||||
FOREIGN KEY(player_id) REFERENCES players(id) ON DELETE CASCADE
|
||||
);
|
||||
""")
|
||||
|
||||
execute("""
|
||||
CREATE TABLE IF NOT EXISTS app_settings (
|
||||
key TEXT PRIMARY KEY,
|
||||
value TEXT NOT NULL DEFAULT '',
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
""")
|
||||
|
||||
execute("""
|
||||
INSERT OR IGNORE INTO app_settings(key, value) VALUES
|
||||
('view_proof_in_view', '0'),
|
||||
('live_active_view', 'group_live'),
|
||||
('live_show_group_live', '1'),
|
||||
('live_group_display_mode', 'rotate'),
|
||||
('live_group_fixed_code', ''),
|
||||
('live_show_prelim_tie', '1'),
|
||||
('live_show_prelim_overall', '1'),
|
||||
('live_show_final_groups', '1'),
|
||||
('live_final_display_mode', 'rotate'),
|
||||
('live_final_fixed_group', '1'),
|
||||
('live_show_final_tie', '1'),
|
||||
('live_show_podium', '1'),
|
||||
('live_rotation_interval_sec', '5'),
|
||||
('live_rotation_player_count', '12');
|
||||
""")
|
||||
|
||||
execute("""
|
||||
INSERT OR IGNORE INTO scores(stage, player_id, score)
|
||||
SELECT 'prelim_r1', player_id, score FROM scores WHERE stage = 'preliminary';
|
||||
""")
|
||||
|
||||
execute("""
|
||||
INSERT OR IGNORE INTO scores(stage, player_id, score)
|
||||
SELECT 'final_r1', player_id, score FROM scores WHERE stage = 'final';
|
||||
""")
|
||||
|
||||
execute("""
|
||||
INSERT OR IGNORE INTO score_attachments(stage, player_id, image_data)
|
||||
SELECT 'prelim_r1', player_id, image_data FROM score_attachments WHERE stage = 'preliminary';
|
||||
""")
|
||||
|
||||
execute("""
|
||||
INSERT OR IGNORE INTO score_attachments(stage, player_id, image_data)
|
||||
SELECT 'final_r1', player_id, image_data FROM score_attachments WHERE stage = 'final';
|
||||
""")
|
||||
end
|
||||
|
||||
def down do
|
||||
execute("DROP TABLE IF EXISTS score_attachments;")
|
||||
execute("DROP TABLE IF EXISTS scores;")
|
||||
execute("DROP TABLE IF EXISTS app_settings;")
|
||||
execute("DROP TABLE IF EXISTS players;")
|
||||
end
|
||||
end
|
||||
11
phoenix/priv/repo/seeds.exs
Normal file
11
phoenix/priv/repo/seeds.exs
Normal file
@@ -0,0 +1,11 @@
|
||||
# Script for populating the database. You can run it as:
|
||||
#
|
||||
# mix run priv/repo/seeds.exs
|
||||
#
|
||||
# Inside the script, you can read and write to any of your
|
||||
# repositories directly:
|
||||
#
|
||||
# ShootingEventPhx.Repo.insert!(%ShootingEventPhx.SomeSchema{})
|
||||
#
|
||||
# We recommend using the bang functions (`insert!`, `update!`
|
||||
# and so on) as they will fail if something goes wrong.
|
||||
BIN
phoenix/priv/static/favicon.ico
Normal file
BIN
phoenix/priv/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 152 B |
5
phoenix/priv/static/robots.txt
Normal file
5
phoenix/priv/static/robots.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
||||
#
|
||||
# To ban all spiders from the entire site uncomment the next two lines:
|
||||
# User-agent: *
|
||||
# Disallow: /
|
||||
Reference in New Issue
Block a user