mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
34 lines
1007 B
JavaScript
34 lines
1007 B
JavaScript
const BAttachment = require('./entities/battachment');
|
|
const BAttribute = require('./entities/battribute');
|
|
const BBlob = require('./entities/bblob');
|
|
const BBranch = require('./entities/bbranch');
|
|
const BEtapiToken = require('./entities/betapi_token');
|
|
const BNote = require('./entities/bnote');
|
|
const BOption = require('./entities/boption');
|
|
const BRecentNote = require('./entities/brecent_note');
|
|
const BRevision = require('./entities/brevision');
|
|
|
|
const ENTITY_NAME_TO_ENTITY = {
|
|
"attachments": BAttachment,
|
|
"attributes": BAttribute,
|
|
"blobs": BBlob,
|
|
"branches": BBranch,
|
|
"etapi_tokens": BEtapiToken,
|
|
"notes": BNote,
|
|
"options": BOption,
|
|
"recent_notes": BRecentNote,
|
|
"revisions": BRevision
|
|
};
|
|
|
|
function getEntityFromEntityName(entityName) {
|
|
if (!(entityName in ENTITY_NAME_TO_ENTITY)) {
|
|
throw new Error(`Entity for table '${entityName}' not found!`);
|
|
}
|
|
|
|
return ENTITY_NAME_TO_ENTITY[entityName];
|
|
}
|
|
|
|
module.exports = {
|
|
getEntityFromEntityName
|
|
};
|