1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Applied prettier to code base

This commit is contained in:
Laurent Cozic
2018-03-09 17:49:35 +00:00
parent e868102c98
commit c4f19465a6
203 changed files with 13395 additions and 7927 deletions

View File

@ -1,10 +1,9 @@
const BaseModel = require('lib/BaseModel.js');
const Note = require('lib/models/Note.js');
const BaseModel = require("lib/BaseModel.js");
const Note = require("lib/models/Note.js");
class Alarm extends BaseModel {
static tableName() {
return 'alarms';
return "alarms";
}
static modelType() {
@ -12,17 +11,19 @@ class Alarm extends BaseModel {
}
static byNoteId(noteId) {
return this.modelSelectOne('SELECT * FROM alarms WHERE note_id = ?', [noteId]);
return this.modelSelectOne("SELECT * FROM alarms WHERE note_id = ?", [noteId]);
}
static async deleteExpiredAlarms() {
return this.db().exec('DELETE FROM alarms WHERE trigger_time <= ?', [Date.now()]);
return this.db().exec("DELETE FROM alarms WHERE trigger_time <= ?", [Date.now()]);
}
static async alarmIdsWithoutNotes() {
// https://stackoverflow.com/a/4967229/561309
const alarms = await this.db().selectAll('SELECT alarms.id FROM alarms LEFT JOIN notes ON alarms.note_id = notes.id WHERE notes.id IS NULL');
return alarms.map((a) => { return a.id });
const alarms = await this.db().selectAll("SELECT alarms.id FROM alarms LEFT JOIN notes ON alarms.note_id = notes.id WHERE notes.id IS NULL");
return alarms.map(a => {
return a.id;
});
}
static async makeNotification(alarm, note = null) {
@ -31,18 +32,17 @@ class Alarm extends BaseModel {
const output = {
id: alarm.id,
date: new Date(note.todo_due),
title: note.title.substr(0,128),
title: note.title.substr(0, 128),
};
if (note.body) output.body = note.body.substr(0,512);
if (note.body) output.body = note.body.substr(0, 512);
return output;
return output;
}
static async allDue() {
return this.modelSelectAll('SELECT * FROM alarms WHERE trigger_time >= ?', [Date.now()]);
return this.modelSelectAll("SELECT * FROM alarms WHERE trigger_time >= ?", [Date.now()]);
}
}
module.exports = Alarm;
module.exports = Alarm;