Add structs and corresponding API routes

This commit is contained in:
nemunaire 2018-06-25 22:20:16 +02:00 committed by Pierre-Olivier Mercier
commit 977a75819d
12 changed files with 942 additions and 1 deletions

View file

@ -62,7 +62,8 @@ CREATE TABLE IF NOT EXISTS rooms (id_room INTEGER NOT NULL PRIMARY KEY AUTO_INCR
CREATE TABLE IF NOT EXISTS tags (id_tag INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, label TEXT NOT NULL);
CREATE TABLE IF NOT EXISTS items (id_item INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, label TEXT NOT NULL, description TEXT NOT NULL, id_room INTEGER);
CREATE TABLE IF NOT EXISTS item_tag (id_item INTEGER NOT NULL, id_tag INTEGER NOT NULL);
CREATE TABLE IF NOT EXISTS users (id_user INTEGER NOT NULL, username VARCHAR(255), password BINARY(64));
CREATE TABLE IF NOT EXISTS users (id_user INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, username VARCHAR(255), password BINARY(64));
CREATE TABLE IF NOT EXISTS checks (id_check INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, id_item INTEGER NOT NULL, id_user INTEGER NOT NULL, passed ENUM('yes', 'no', 'yesbut', 'nobut') NOT NULL, comment TEXT NOT NULL);
`
for _, ln := range strings.Split(ct, "\n") {
if len(ln) == 0 {