v1.0: First production version
This first version allows login of pre-existing users, creation and update of truths by admins, vote on the truths by users, their display as well as a simple graph for the vote results. Everything persisting in a SQLite database.
This commit is contained in:
commit
9911895b5b
22 changed files with 4790 additions and 0 deletions
35
db/00_create-tables.sql
Normal file
35
db/00_create-tables.sql
Normal file
|
@ -0,0 +1,35 @@
|
|||
CREATE TABLE IF NOT EXISTS Players (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
is_admin INTEGER NOT NULL DEFAULT 0,
|
||||
name VARCHAR NOT NULL,
|
||||
pwd_hash VARCHAR NOT NULL,
|
||||
picture VARCHAR
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS Truths (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
week INTEGER NOT NULL CHECK (week > 0),
|
||||
number INTEGER NOT NULL CHECK (number > 0),
|
||||
author_id INTEGER NOT NULL,
|
||||
rendered_text VARCHAR NOT NULL,
|
||||
raw_text VARCHAR NOT NULL,
|
||||
FOREIGN KEY (author_id) REFERENCES Players(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS Votes (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
truth_id INTEGER NOT NULL,
|
||||
voter_id INTEGER NOT NULL,
|
||||
voted_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (truth_id) REFERENCES Truths(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (voter_id) REFERENCES Players(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (voted_id) REFERENCES Players(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AuthTokens (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
player_id INTEGER NOT NULL,
|
||||
token VARCHAR NOT NULL,
|
||||
max_timestamp INTEGER NOT NULL,
|
||||
FOREIGN KEY (player_id) REFERENCES Players(id) ON DELETE CASCADE
|
||||
);
|
10
db/01_create-players.sql
Normal file
10
db/01_create-players.sql
Normal file
|
@ -0,0 +1,10 @@
|
|||
INSERT INTO Players (name, pwd_hash) VALUES ("Bystus", "$argon2id$v=19$m=4096,t=3,p=1$WXRDblJ3SGNQUUl1d0dyZFdwSzR2UT09$by9LM1LJ+geBhn6wvEzpiUsR7Tm7Ce9wIrqTTsbXyV0");
|
||||
INSERT INTO Players (name, pwd_hash) VALUES ("Corwyn", "$argon2id$v=19$m=4096,t=3,p=1$L2FNWW9BZUxPR0NTUEkwaGNib0xwZz09$x2pUo5IY0iq4xrzoXnHMEaX9oFGbkgaBFcnQ3EJ4Cts");
|
||||
INSERT INTO Players (name, pwd_hash) VALUES ("Dory", "$argon2id$v=19$m=4096,t=3,p=1$ekoxV1BrMDBIS1EzUC95SDRrVEZQZz09$Sv2xBUcNo8Ckm+tSiNjs1zBI7KGnCzNbd1ZEa3ABhmg");
|
||||
INSERT INTO Players (name, pwd_hash) VALUES ("Fen", "$argon2id$v=19$m=4096,t=3,p=1$d3pwaldqR2lNWThjZ0d5a29TNEh2Zz09$UsrRRUMdztOLoRJ/R7tP+YUl0EdCaeSYPImm7onlezM");
|
||||
INSERT INTO Players (name, pwd_hash) VALUES ("Lucky", "$argon2id$v=19$m=4096,t=3,p=1$dmZ2ZDNmUi9PaTBIOVFoQ0IvZ2JzUT09$agitRdj8VQS9oseMq7CHw3grugQ5u10L/k13KK1cZew");
|
||||
INSERT INTO Players (name, pwd_hash) VALUES ("Nico", "$argon2id$v=19$m=4096,t=3,p=1$K0Flb1BFb1czMEhtandLTjNGbDg5UT09$HNswLN3GsvOpBfQ6Ik/q9422XnguN4Pp9dMBWlwMmPU");
|
||||
INSERT INTO Players (name, pwd_hash) VALUES ("Peran", "$argon2id$v=19$m=4096,t=3,p=1$eUNTVlVvRjloekpXemZwUUMxb1p0QT09$DrtCsJ8Ok6Sid0YeWs82/XCjni7xqAslnVIo7npNB3k");
|
||||
INSERT INTO Players (name, pwd_hash) VALUES ("trot", "$argon2id$v=19$m=4096,t=3,p=1$dHdnVDdIMUpqdFJhYnAyc2NnYms1Zz09$H36JGR1/gvF0buJ+6+A5fyqncAqxixV1gGceF8sz/PE");
|
||||
|
||||
UPDATE Players SET is_admin = 1 WHERE name == "Corwyn";
|
21
db/02_create-dummy-truths.sql
Normal file
21
db/02_create-dummy-truths.sql
Normal file
|
@ -0,0 +1,21 @@
|
|||
--INSERT INTO Truths (week, number, rendered_text, raw_text, author_id) VALUES (1, 1,
|
||||
-- "This is a bit of bullshit that might be a looooot of bullshit, like, fucking hell, a lot.",
|
||||
-- "This is a bit of bullshit that might be a looooot of bullshit, like, fucking hell, a lot.", 1);
|
||||
--INSERT INTO Truths (week, number, rendered_text, raw_text, author_id) VALUES (1, 6,
|
||||
-- "This one, small one",
|
||||
-- "This one, small one", 4);
|
||||
--INSERT INTO Truths (week, number, rendered_text, raw_text, author_id) VALUES (1, 3,
|
||||
-- "At the time of writing, the share price is down more than 19 percent as the security shop to some of the biggest organizations in the world continues to work through issues with its customers.",
|
||||
-- "At the time of writing, the share price is down more than 19 percent as the security shop to some of the biggest organizations in the world continues to work through issues with its customers.", 5);
|
||||
--INSERT INTO Truths (week, number, rendered_text, raw_text, author_id) VALUES (1, 4,
|
||||
-- "Les récentes recherches démontrent qu’une civilisation perdue aurait développée une technologie fonctionnant à base de cristaux de mana élémentaires. Les outils actuels sont limités quand à l’utilisation de ces derniers mais nul doute que si l’on parvenait à les utiliser le monde entier subirait une révolution technologique. ",
|
||||
-- "Les récentes recherches démontrent qu’une civilisation perdue aurait développée une technologie fonctionnant à base de cristaux de mana élémentaires. Les outils actuels sont limités quand à l’utilisation de ces derniers mais nul doute que si l’on parvenait à les utiliser le monde entier subirait une révolution technologique. ", 3);
|
||||
--INSERT INTO Truths (week, number, rendered_text, raw_text, author_id) VALUES (1, 5,
|
||||
-- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet egestas lacus at posuere. Donec quis laoreet lacus. Curabitur aliquam pharetra ligula vestibulum lacinia. Donec vitae elit venenatis, interdum lacus a, lobortis sem. Aliquam non dictum velit, at sagittis ex. Duis vestibulum nisi vitae mattis posuere. Integer rutrum accumsan diam. Cras cursus sapien tempus, bibendum metus et, scelerisque erat. Etiam eleifend vitae nunc vel pretium. Ut ipsum risus, consequat ac orci a, varius aliquam sapien. Integer ut elit bibendum, bibendum dui ac, maximus lacus. Aenean scelerisque sapien id tincidunt euismod. Morbi placerat, massa ac vehicula congue, mi sem eleifend diam, id consequat mauris nibh non neque. Integer et lacus leo. Aliquam hendrerit facilisis arcu at auctor. ",
|
||||
-- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet egestas lacus at posuere. Donec quis laoreet lacus. Curabitur aliquam pharetra ligula vestibulum lacinia. Donec vitae elit venenatis, interdum lacus a, lobortis sem. Aliquam non dictum velit, at sagittis ex. Duis vestibulum nisi vitae mattis posuere. Integer rutrum accumsan diam. Cras cursus sapien tempus, bibendum metus et, scelerisque erat. Etiam eleifend vitae nunc vel pretium. Ut ipsum risus, consequat ac orci a, varius aliquam sapien. Integer ut elit bibendum, bibendum dui ac, maximus lacus. Aenean scelerisque sapien id tincidunt euismod. Morbi placerat, massa ac vehicula congue, mi sem eleifend diam, id consequat mauris nibh non neque. Integer et lacus leo. Aliquam hendrerit facilisis arcu at auctor. ", 6);
|
||||
--INSERT INTO Truths (week, number, rendered_text, raw_text, author_id) VALUES (1, 2,
|
||||
-- "And another one ! And another one ! And another one ! And another one ! And another one ! And another one ! And another one ! And another one !",
|
||||
-- "And another one ! And another one ! And another one ! And another one ! And another one ! And another one ! And another one ! And another one !", 8);
|
||||
--INSERT INTO Truths (week, number, rendered_text, raw_text, author_id) VALUES (1, 7,
|
||||
-- "Sure <b>why not</b> use emojis 🍌 and tags",
|
||||
-- "Sure *why not* use emojis 🍌 and tags", 7);
|
Loading…
Add table
Add a link
Reference in a new issue