Notes/src/becca/entities/brecent_note.ts

37 lines
883 B
TypeScript
Raw Normal View History

2021-05-02 19:59:16 +02:00
"use strict";
import { RecentNoteRow } from "./rows";
import dateUtils = require('../../services/date_utils');
import AbstractBeccaEntity = require('./abstract_becca_entity');
2021-05-02 19:59:16 +02:00
/**
* RecentNote represents recently visited note.
*/
class BRecentNote extends AbstractBeccaEntity<BRecentNote> {
2021-05-02 19:59:16 +02:00
static get entityName() { return "recent_notes"; }
static get primaryKeyName() { return "noteId"; }
noteId: string;
notePath: string;
utcDateCreated: string;
constructor(row: RecentNoteRow) {
2021-05-02 19:59:16 +02:00
super();
this.noteId = row.noteId;
this.notePath = row.notePath;
this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime();
}
getPojo() {
return {
noteId: this.noteId,
notePath: this.notePath,
utcDateCreated: this.utcDateCreated
}
}
2021-05-02 19:59:16 +02:00
}
export = BRecentNote;