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 becca = require('../becca/becca');
|
||||||
const eu = require('./etapi_utils');
|
const eu = require('./etapi_utils');
|
||||||
const mappers = require('./mappers.js');
|
const mappers = require('./mappers');
|
||||||
const v = require('./validators.js');
|
const v = require('./validators.js');
|
||||||
const utils = require('../services/utils');
|
const utils = require('../services/utils');
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const becca = require('../becca/becca');
|
const becca = require('../becca/becca');
|
||||||
const eu = require('./etapi_utils');
|
const eu = require('./etapi_utils');
|
||||||
const mappers = require('./mappers.js');
|
const mappers = require('./mappers');
|
||||||
const attributeService = require('../services/attributes');
|
const attributeService = require('../services/attributes');
|
||||||
const v = require('./validators.js');
|
const v = require('./validators.js');
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const becca = require('../becca/becca');
|
const becca = require('../becca/becca');
|
||||||
const eu = require('./etapi_utils');
|
const eu = require('./etapi_utils');
|
||||||
const mappers = require('./mappers.js');
|
const mappers = require('./mappers');
|
||||||
const BBranch = require('../becca/entities/bbranch');
|
const BBranch = require('../becca/entities/bbranch');
|
||||||
const entityChangesService = require('../services/entity_changes');
|
const entityChangesService = require('../services/entity_changes');
|
||||||
const v = require('./validators.js');
|
const v = require('./validators.js');
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
/** @param {BNote} note */
|
import BAttachment = require("../becca/entities/battachment");
|
||||||
function mapNoteToPojo(note) {
|
import BAttribute = require("../becca/entities/battribute");
|
||||||
|
import BBranch = require("../becca/entities/bbranch");
|
||||||
|
import BNote = require("../becca/entities/bnote");
|
||||||
|
|
||||||
|
function mapNoteToPojo(note: BNote) {
|
||||||
return {
|
return {
|
||||||
noteId: note.noteId,
|
noteId: note.noteId,
|
||||||
isProtected: note.isProtected,
|
isProtected: note.isProtected,
|
||||||
@ -19,8 +23,7 @@ function mapNoteToPojo(note) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {BBranch} branch */
|
function mapBranchToPojo(branch: BBranch) {
|
||||||
function mapBranchToPojo(branch) {
|
|
||||||
return {
|
return {
|
||||||
branchId: branch.branchId,
|
branchId: branch.branchId,
|
||||||
noteId: branch.noteId,
|
noteId: branch.noteId,
|
||||||
@ -32,8 +35,7 @@ function mapBranchToPojo(branch) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {BAttribute} attr */
|
function mapAttributeToPojo(attr: BAttribute) {
|
||||||
function mapAttributeToPojo(attr) {
|
|
||||||
return {
|
return {
|
||||||
attributeId: attr.attributeId,
|
attributeId: attr.attributeId,
|
||||||
noteId: attr.noteId,
|
noteId: attr.noteId,
|
||||||
@ -46,8 +48,7 @@ function mapAttributeToPojo(attr) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {BAttachment} attachment */
|
function mapAttachmentToPojo(attachment: BAttachment) {
|
||||||
function mapAttachmentToPojo(attachment) {
|
|
||||||
return {
|
return {
|
||||||
attachmentId: attachment.attachmentId,
|
attachmentId: attachment.attachmentId,
|
||||||
ownerId: attachment.ownerId,
|
ownerId: attachment.ownerId,
|
||||||
@ -63,7 +64,7 @@ function mapAttachmentToPojo(attachment) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
export = {
|
||||||
mapNoteToPojo,
|
mapNoteToPojo,
|
||||||
mapBranchToPojo,
|
mapBranchToPojo,
|
||||||
mapAttributeToPojo,
|
mapAttributeToPojo,
|
@ -1,7 +1,7 @@
|
|||||||
const becca = require('../becca/becca');
|
const becca = require('../becca/becca');
|
||||||
const utils = require('../services/utils');
|
const utils = require('../services/utils');
|
||||||
const eu = require('./etapi_utils');
|
const eu = require('./etapi_utils');
|
||||||
const mappers = require('./mappers.js');
|
const mappers = require('./mappers');
|
||||||
const noteService = require('../services/notes');
|
const noteService = require('../services/notes');
|
||||||
const TaskContext = require('../services/task_context');
|
const TaskContext = require('../services/task_context');
|
||||||
const v = require('./validators.js');
|
const v = require('./validators.js');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const specialNotesService = require('../services/special_notes');
|
const specialNotesService = require('../services/special_notes');
|
||||||
const dateNotesService = require('../services/date_notes');
|
const dateNotesService = require('../services/date_notes');
|
||||||
const eu = require('./etapi_utils');
|
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 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.`);
|
const getMonthInvalidError = month => new eu.EtapiError(400, "MONTH_INVALID", `Month "${month}" is not valid.`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user