mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
bddb0ba754
refs https://github.com/TryGhost/Team/issues/1910 refs https://github.com/TryGhost/Team/issues/1888 - Uses an in-memory repository for now whilst in development - Updates the LinkReplacementService to choose the slug - Exposes a `getSlug` method so we can ensure uniqueness - Emits the RedirectEvent for use by LinkTracking
26 lines
580 B
JavaScript
26 lines
580 B
JavaScript
const ObjectID = require('bson-objectid').default;
|
|
|
|
module.exports = class ClickEvent {
|
|
/** @type {ObjectID} */
|
|
event_id;
|
|
/** @type {ObjectID} */
|
|
member_id;
|
|
/** @type {ObjectID} */
|
|
link_id;
|
|
|
|
constructor(data) {
|
|
if (!data.id) {
|
|
this.event_id = new ObjectID();
|
|
}
|
|
|
|
if (typeof data.id === 'string') {
|
|
this.event_id = ObjectID.createFromHexString(data.id);
|
|
} else {
|
|
this.event_id = data.id;
|
|
}
|
|
|
|
this.member_id = data.member_id;
|
|
this.link_id = data.link_id;
|
|
}
|
|
};
|