mirror of
https://github.com/status-im/codimd.git
synced 2025-01-12 03:24:13 +00:00
lint: lib/services/note.ts
- add typing annotate in checkAllNotesRevision and saveAllNotesRevision - passing string in error constructor in app.ts Signed-off-by: Raccoon <raccoon@hackmd.io>
This commit is contained in:
parent
738a4b4ca9
commit
016e16968d
@ -290,7 +290,7 @@ sequelize.sync().then(function () {
|
||||
// check if realtime is ready
|
||||
if (realtime.isReady()) {
|
||||
checkAllNotesRevision(function (err, notes) {
|
||||
if (err) throw new Error(err)
|
||||
if (err) throw new Error(err.toString())
|
||||
if (!notes || notes.length <= 0) return startListen()
|
||||
})
|
||||
} else {
|
||||
|
@ -6,7 +6,11 @@ import {Note, Revision, NoteAttributes} from "../models";
|
||||
|
||||
const dmp = new DiffMatchPatch()
|
||||
|
||||
export function checkAllNotesRevision(callback) {
|
||||
interface Callback {
|
||||
(err: Error | string | null, notes?: Note[] | null): void
|
||||
}
|
||||
|
||||
export function checkAllNotesRevision(callback: Callback): void {
|
||||
saveAllNotesRevision(function (err, notes) {
|
||||
if (err) return callback(err, null)
|
||||
if (!notes || notes.length <= 0) {
|
||||
@ -17,7 +21,7 @@ export function checkAllNotesRevision(callback) {
|
||||
})
|
||||
}
|
||||
|
||||
export function saveAllNotesRevision(callback: any): void {
|
||||
export function saveAllNotesRevision(callback: Callback): void {
|
||||
Note.findAll({
|
||||
// query all notes that need to save for revision
|
||||
where: {
|
||||
@ -43,7 +47,7 @@ export function saveAllNotesRevision(callback: any): void {
|
||||
}
|
||||
]
|
||||
}
|
||||
}).then(function (notes) {
|
||||
}).then(function (notes: Note[]) {
|
||||
if (notes.length <= 0) return callback(null, notes)
|
||||
const savedNotes = []
|
||||
async.each(notes, function (note, _callback) {
|
||||
@ -77,7 +81,7 @@ export function saveAllNotesRevision(callback: any): void {
|
||||
})
|
||||
}
|
||||
|
||||
export async function syncNote(noteInFS, note): Promise<string> {
|
||||
export async function syncNote(noteInFS: Partial<Note>, note: Note): Promise<string> {
|
||||
const contentLength = noteInFS.content.length
|
||||
|
||||
let note2 = await note.update({
|
||||
|
Loading…
x
Reference in New Issue
Block a user