mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 00:52:36 +03:00
5f928794c3
refs https://github.com/TryGhost/Team/issues/2078 These events are all required for other parts of the Ghost system to stay in sync. The events on each Tier object will be dispatched by the TierRepository once they've been persisted. TierCreatedEvent - generate Stripe Products & Prices TierNameChangeEvent - update Stripe Products TierPriceChangeEvent - update Stripe Products & Prices TierArchivedEvent - update the Portal settings for visible tiers - disable Stripe Products & Prices TierActivatedEvent - enable Stripe Products & Prices
31 lines
639 B
JavaScript
31 lines
639 B
JavaScript
/**
|
|
* @typedef {object} TierPriceChangeEventData
|
|
* @prop {Tier} tier
|
|
*/
|
|
|
|
class TierPriceChangeEvent {
|
|
/** @type {TierPriceChangeEventData} */
|
|
data;
|
|
/** @type {Date} */
|
|
timestamp;
|
|
|
|
/**
|
|
* @param {TierPriceChangeEvent} data
|
|
* @param {Date} timestamp
|
|
*/
|
|
constructor(data, timestamp) {
|
|
this.data = data;
|
|
this.timestamp = timestamp;
|
|
}
|
|
|
|
/**
|
|
* @param {TierPriceChangeEvent} data
|
|
* @param {Date} [timestamp]
|
|
*/
|
|
static create(data, timestamp = new Date()) {
|
|
return new TierPriceChangeEvent(data, timestamp);
|
|
}
|
|
}
|
|
|
|
module.exports = TierPriceChangeEvent;
|