1
0
mirror of https://github.com/TryGhost/Ghost.git synced 2024-12-23 10:53:34 +03:00
Ghost/ghost/link-redirects/lib/LinkRedirect.js
Rishabh d7b3721036 Added edited property to links api
refs https://github.com/TryGhost/Team/issues/2104

- adds a boolean `edited` property to links api that denotes if the link has been edited
2022-10-20 18:17:44 +05:30

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;
}
};