From b60ac2105aaeffb66783b8ffdcdde2a11d13d126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Fri, 10 May 2019 14:34:58 +0200 Subject: [PATCH] defined test database --- backend/db.coffee | 28 ++++++++++++++++------------ backend/session.coffee | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/backend/db.coffee b/backend/db.coffee index d4debdf..583d21c 100644 --- a/backend/db.coffee +++ b/backend/db.coffee @@ -43,18 +43,22 @@ class FFTCGDB ''', (err) => logger.error err.message if err - @db.run 'DROP TABLE IF EXISTS decks;', (err) => - logger.error err.message if err - @db.run ''' - CREATE TABLE decks ( - deck integer PRIMARY KEY, - user integer NOT NULL, - json text, - FOREIGN KEY (user) REFERENCES users (user) - ON DELETE CASCADE - ); - ''', (err) => - logger.error err.message if err + @db.run 'DROP TABLE IF EXISTS decks;', (err) => + logger.error err.message if err + @db.run ''' + CREATE TABLE decks ( + deck integer PRIMARY KEY, + user integer NOT NULL, + json text, + FOREIGN KEY (user) REFERENCES users (user) + ON DELETE CASCADE + ); + ''', (err) => + logger.error err.message if err + + @db.run '''INSERT INTO users VALUES(1,'jmm','$2b$13$jgDdHHDWqq1RV6PXxf7aOO6AbxqY6tbxIADyIO0FeXt2BlKQCCMzS',NULL);''' + @db.run '''INSERT INTO decks VALUES(1,1,'{"name":"frosch"}');''' + @db.run '''INSERT INTO decks VALUES(2,1,'{"name":"frosch2"}');''' logger.info 'OK clear' diff --git a/backend/session.coffee b/backend/session.coffee index d3e61ba..f315f27 100644 --- a/backend/session.coffee +++ b/backend/session.coffee @@ -56,7 +56,7 @@ class FFTCGSESSION else @db.get digest, (err, res) -> - logger.info "OK '#{digest}' resumed" + logger.debug "OK '#{digest}' resumed" resolve (JSON.parse res) module.exports = new FFTCGSESSION