|
@@ -7,6 +7,7 @@ function load () {
|
|
db.exec('CREATE TABLE IF NOT EXISTS cosette (uuid TEXT PRIMARY KEY, name TEXT NOT NULL, description TEXT, tags TEXT, images TEXT, updatedAt DATETIME DEFAULT CURRENT_TIMESTAMP)')
|
|
db.exec('CREATE TABLE IF NOT EXISTS cosette (uuid TEXT PRIMARY KEY, name TEXT NOT NULL, description TEXT, tags TEXT, images TEXT, updatedAt DATETIME DEFAULT CURRENT_TIMESTAMP)')
|
|
db.exec('CREATE TABLE IF NOT EXISTS chan (uuid TEXT PRIMARY KEY, cosetta_uuid REFERENCES cosette(uuid), message TEXT, updatedAt DATETIME DEFAULT CURRENT_TIMESTAMP)')
|
|
db.exec('CREATE TABLE IF NOT EXISTS chan (uuid TEXT PRIMARY KEY, cosetta_uuid REFERENCES cosette(uuid), message TEXT, updatedAt DATETIME DEFAULT CURRENT_TIMESTAMP)')
|
|
}
|
|
}
|
|
|
|
+// TODO: da gestire in qualche modo all'avvio
|
|
// load()
|
|
// load()
|
|
|
|
|
|
export function add (cosetta) {
|
|
export function add (cosetta) {
|
|
@@ -42,10 +43,8 @@ export function getAll (limit=0, offset=0, tags=[], search='') {
|
|
|
|
|
|
|
|
|
|
export function addComment (comment) {
|
|
export function addComment (comment) {
|
|
- console.error('sono dentro addComment', comment)
|
|
|
|
const q = db.prepare('INSERT INTO chan (uuid, cosetta_uuid, message) VALUES(:uuid, :cosetta_uuid, :message)')
|
|
const q = db.prepare('INSERT INTO chan (uuid, cosetta_uuid, message) VALUES(:uuid, :cosetta_uuid, :message)')
|
|
comment.uuid = v4()
|
|
comment.uuid = v4()
|
|
- console.error(comment)
|
|
|
|
q.run(comment)
|
|
q.run(comment)
|
|
return comment
|
|
return comment
|
|
}
|
|
}
|