mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server-ts: Convert etapi/mappers
This commit is contained in:
parent
26859e83e4
commit
4bb46aeb9c
@ -1,6 +1,6 @@
|
||||
const becca = require('../becca/becca');
|
||||
const eu = require('./etapi_utils');
|
||||
const mappers = require('./mappers.js');
|
||||
const mappers = require('./mappers');
|
||||
const v = require('./validators.js');
|
||||
const utils = require('../services/utils');
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
const becca = require('../becca/becca');
|
||||
const eu = require('./etapi_utils');
|
||||
const mappers = require('./mappers.js');
|
||||
const mappers = require('./mappers');
|
||||
const attributeService = require('../services/attributes');
|
||||
const v = require('./validators.js');
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
const becca = require('../becca/becca');
|
||||
const eu = require('./etapi_utils');
|
||||
const mappers = require('./mappers.js');
|
||||
const mappers = require('./mappers');
|
||||
const BBranch = require('../becca/entities/bbranch');
|
||||
const entityChangesService = require('../services/entity_changes');
|
||||
const v = require('./validators.js');
|
||||
|
@ -1,5 +1,9 @@
|
||||
/** @param {BNote} note */
|
||||
function mapNoteToPojo(note) {
|
||||
import BAttachment = require("../becca/entities/battachment");
|
||||
import BAttribute = require("../becca/entities/battribute");
|
||||
import BBranch = require("../becca/entities/bbranch");
|
||||
import BNote = require("../becca/entities/bnote");
|
||||
|
||||
function mapNoteToPojo(note: BNote) {
|
||||
return {
|
||||
noteId: note.noteId,
|
||||
isProtected: note.isProtected,
|
||||
@ -19,8 +23,7 @@ function mapNoteToPojo(note) {
|
||||
};
|
||||
}
|
||||
|
||||
/** @param {BBranch} branch */
|
||||
function mapBranchToPojo(branch) {
|
||||
function mapBranchToPojo(branch: BBranch) {
|
||||
return {
|
||||
branchId: branch.branchId,
|
||||
noteId: branch.noteId,
|
||||
@ -32,8 +35,7 @@ function mapBranchToPojo(branch) {
|
||||
};
|
||||
}
|
||||
|
||||
/** @param {BAttribute} attr */
|
||||
function mapAttributeToPojo(attr) {
|
||||
function mapAttributeToPojo(attr: BAttribute) {
|
||||
return {
|
||||
attributeId: attr.attributeId,
|
||||
noteId: attr.noteId,
|
||||
@ -46,8 +48,7 @@ function mapAttributeToPojo(attr) {
|
||||
};
|
||||
}
|
||||
|
||||
/** @param {BAttachment} attachment */
|
||||
function mapAttachmentToPojo(attachment) {
|
||||
function mapAttachmentToPojo(attachment: BAttachment) {
|
||||
return {
|
||||
attachmentId: attachment.attachmentId,
|
||||
ownerId: attachment.ownerId,
|
||||
@ -63,7 +64,7 @@ function mapAttachmentToPojo(attachment) {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
mapNoteToPojo,
|
||||
mapBranchToPojo,
|
||||
mapAttributeToPojo,
|
@ -1,7 +1,7 @@
|
||||
const becca = require('../becca/becca');
|
||||
const utils = require('../services/utils');
|
||||
const eu = require('./etapi_utils');
|
||||
const mappers = require('./mappers.js');
|
||||
const mappers = require('./mappers');
|
||||
const noteService = require('../services/notes');
|
||||
const TaskContext = require('../services/task_context');
|
||||
const v = require('./validators.js');
|
||||
|
@ -1,7 +1,7 @@
|
||||
const specialNotesService = require('../services/special_notes');
|
||||
const dateNotesService = require('../services/date_notes');
|
||||
const eu = require('./etapi_utils');
|
||||
const mappers = require('./mappers.js');
|
||||
const mappers = require('./mappers');
|
||||
|
||||
const getDateInvalidError = date => new eu.EtapiError(400, "DATE_INVALID", `Date "${date}" is not valid.`);
|
||||
const getMonthInvalidError = month => new eu.EtapiError(400, "MONTH_INVALID", `Month "${month}" is not valid.`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user