28 lines
587 B
JavaScript
28 lines
587 B
JavaScript
|
/** @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;
|