-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
2,189 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# Matches multiple files with brace expansion notation | ||
# Set default charset | ||
[*.{js}] | ||
charset = utf-8 | ||
|
||
[*.js] | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"google" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"require-jsdoc": 0, | ||
"max-len": ["error", 100] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run eslint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
import Datastore from 'nedb' | ||
import config from 'config' | ||
import Datastore from 'nedb'; | ||
import config from 'config'; | ||
|
||
const dbPath = config.get('DbPath') | ||
const dbPath = config.get('DbPath'); | ||
|
||
console.log(`Initialising DB (${dbPath})...`) | ||
let db = new Datastore({filename: dbPath, autoload: true, onload: (error) => { | ||
if (error) | ||
console.log(`Failed to load DB: ${error}`) | ||
}}) | ||
console.log(`Initialising DB (${dbPath})...`); | ||
const db = new Datastore({filename: dbPath, autoload: true, onload: (error) => { | ||
if (error) { | ||
console.log(`Failed to load DB: ${error}`); | ||
} | ||
}}); | ||
|
||
db.findOne({}).sort({ createdAt: -1 }).exec((err, doc) => { | ||
if (err) { | ||
console.log(`Error selecting from DB: ${err}`) | ||
return | ||
} | ||
db.findOne({}).sort({createdAt: -1}).exec((err, doc) => { | ||
if (err) { | ||
console.log(`Error selecting from DB: ${err}`); | ||
return; | ||
} | ||
|
||
if (doc) { | ||
const now = new Date() | ||
delete doc._id | ||
doc.createdAt = now.toISOString() | ||
console.log(doc) | ||
if (doc) { | ||
const now = new Date(); | ||
delete doc._id; | ||
doc.createdAt = now.toISOString(); | ||
console.log(doc); | ||
|
||
db.insert(doc, function (err, newItem) { | ||
if (err) { | ||
console.log(`Error inserting into DB: ${err}`) | ||
return | ||
} | ||
console.log(`Successfully inserted into DB`) | ||
}) | ||
} | ||
}) | ||
db.insert(doc, function(err, newItem) { | ||
if (err) { | ||
console.log(`Error inserting into DB: ${err}`); | ||
return; | ||
} | ||
console.log(`Successfully inserted into DB`); | ||
}); | ||
} | ||
}); |
Oops, something went wrong.