2021-05-02 19:59:16 +02:00
|
|
|
"use strict";
|
|
|
|
|
2024-02-17 00:44:44 +02:00
|
|
|
import { RecentNoteRow } from "./rows";
|
|
|
|
|
|
|
|
import dateUtils = require('../../services/date_utils');
|
2024-02-17 11:16:00 +02:00
|
|
|
import AbstractBeccaEntity = require('./abstract_becca_entity');
|
2021-05-02 19:59:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* RecentNote represents recently visited note.
|
|
|
|
*/
|
2024-02-17 11:13:53 +02:00
|
|
|
class BRecentNote extends AbstractBeccaEntity<BRecentNote> {
|
2021-05-02 19:59:16 +02:00
|
|
|
static get entityName() { return "recent_notes"; }
|
|
|
|
static get primaryKeyName() { return "noteId"; }
|
|
|
|
|
2024-02-17 00:44:44 +02:00
|
|
|
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();
|
|
|
|
}
|
2021-05-08 22:13:08 +02:00
|
|
|
|
|
|
|
getPojo() {
|
|
|
|
return {
|
|
|
|
noteId: this.noteId,
|
|
|
|
notePath: this.notePath,
|
|
|
|
utcDateCreated: this.utcDateCreated
|
|
|
|
}
|
|
|
|
}
|
2021-05-02 19:59:16 +02:00
|
|
|
}
|
|
|
|
|
2023-01-03 13:52:37 +01:00
|
|
|
module.exports = BRecentNote;
|