Ghost/ghost/member-events/lib/MemberSubscribeEvent.js

25 lines
603 B
JavaScript
Raw Normal View History

/**
* @typedef {object} MemberSubscribeEventData
* @prop {string} memberId
* @prop {'import' | 'system' | 'api' | 'admin' | 'member'} source
*/
module.exports = class MemberSubscribeEvent {
/**
* @param {MemberSubscribeEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
this.timestamp = timestamp;
}
/**
* @param {MemberSubscribeEventData} data
* @param {Date} [timestamp]
*/
static create(data, timestamp) {
return new MemberSubscribeEvent(data, timestamp || new Date);
}
};