Ghost/ghost/offers/lib/domain/events/OfferCreated.js

28 lines
587 B
JavaScript
Raw Normal View History

/** @typedef {import('../models/Offer')} Offer */
/**
* @typedef {object} OfferCreatedEventData
* @prop {Offer} offer
*/
class OfferCreatedEvent {
/**
* @param {OfferCreatedEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
this.timestamp = timestamp;
}
/**
* @param {OfferCreatedEventData} data
* @param {Date} [timestamp]
*/
static create(data, timestamp) {
return new OfferCreatedEvent(data, timestamp || new Date);
}
}
module.exports = OfferCreatedEvent;