mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-19 05:09:41 +02:00
* Added uri property to Page model * Added aliases collection * Added routing form aliases * Fixed redirect after page creation * Added abiltity to support few pages with same title * Added ability to change uri manually * Changed hash function * Changed uri parsing * Removed pages controller promise * Modified page's tests * Added tests for alias model * Added tests for aliases * Escaping special characters * Added missed files * Fixed bugs related to translation * Fixed parent page link * Added server validation for uri * Changed css properties order * Made uri property of page be optional * Prevented alias creation from empty uri * Moved alias types to model
26 lines
501 B
JavaScript
26 lines
501 B
JavaScript
const Alias = require('../models/alias');
|
|
|
|
/**
|
|
* @class Aliases
|
|
* @classdesc Aliases controller
|
|
*/
|
|
class Aliases {
|
|
/**
|
|
* @static
|
|
* Find and return entity with given alias
|
|
*
|
|
* @param {string} aliasName - alias name of entity
|
|
* @returns {Promise<Alias>}
|
|
*/
|
|
static async get(aliasName) {
|
|
const alias = await Alias.get(aliasName);
|
|
|
|
if (!alias.id) {
|
|
throw new Error('Entity with given alias does not exist');
|
|
}
|
|
|
|
return alias;
|
|
}
|
|
}
|
|
|
|
module.exports = Aliases;
|