mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
d7b3721036
refs https://github.com/TryGhost/Team/issues/2104 - adds a boolean `edited` property to links api that denotes if the link has been edited
27 lines
561 B
JavaScript
27 lines
561 B
JavaScript
const ObjectID = require('bson-objectid').default;
|
|
|
|
module.exports = class LinkRedirect {
|
|
/** @type {ObjectID} */
|
|
link_id;
|
|
/** @type {URL} */
|
|
from;
|
|
/** @type {URL} */
|
|
to;
|
|
/** @type {boolean} */
|
|
edited;
|
|
|
|
constructor(data) {
|
|
if (!data.id) {
|
|
this.link_id = new ObjectID();
|
|
}
|
|
|
|
if (typeof data.id === 'string') {
|
|
this.link_id = ObjectID.createFromHexString(data.id);
|
|
}
|
|
|
|
this.from = data.from;
|
|
this.to = data.to;
|
|
this.edited = !!data.edited;
|
|
}
|
|
};
|