2017-05-10 21:21:09 +02:00
|
|
|
import { BaseModel } from 'src/base-model.js';
|
2017-05-11 22:14:01 +02:00
|
|
|
import { Log } from 'src/log.js';
|
2017-05-10 21:21:09 +02:00
|
|
|
|
|
|
|
class Note extends BaseModel {
|
|
|
|
|
2017-05-10 21:51:43 +02:00
|
|
|
static tableName() {
|
|
|
|
return 'notes';
|
|
|
|
}
|
|
|
|
|
2017-05-12 21:54:06 +02:00
|
|
|
static useUuid() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-10 21:51:43 +02:00
|
|
|
static newNote() {
|
|
|
|
return {
|
|
|
|
id: null,
|
|
|
|
title: '',
|
|
|
|
body: '',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-11 22:14:01 +02:00
|
|
|
static previews() {
|
|
|
|
return this.db().selectAll('SELECT id, title, body, updated_time FROM notes').then((r) => {
|
|
|
|
let output = [];
|
|
|
|
for (let i = 0; i < r.rows.length; i++) {
|
|
|
|
output.push(r.rows.item(i));
|
|
|
|
}
|
|
|
|
return output;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-05-10 21:21:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export { Note };
|