diff --git a/ghost/collections/src/events/CollectionPostAdded.ts b/ghost/collections/src/events/CollectionPostAdded.ts new file mode 100644 index 0000000000..00cb8d5dec --- /dev/null +++ b/ghost/collections/src/events/CollectionPostAdded.ts @@ -0,0 +1,19 @@ +type CollectionPostAddedData = { + collection_id: string; + post_id: string; +}; + +export class CollectionPostAdded { + data: CollectionPostAddedData; + timestamp: Date; + type = 'CollectionPostAdded' as const; + + constructor(data: CollectionPostAddedData, timestamp: Date) { + this.data = data; + this.timestamp = timestamp; + } + + static create(data: CollectionPostAddedData, timestamp = new Date()) { + return new CollectionPostAdded(data, timestamp); + } +} diff --git a/ghost/collections/src/events/CollectionPostRemoved.ts b/ghost/collections/src/events/CollectionPostRemoved.ts new file mode 100644 index 0000000000..305f6b8eec --- /dev/null +++ b/ghost/collections/src/events/CollectionPostRemoved.ts @@ -0,0 +1,19 @@ +type CollectionPostRemovedData = { + collection_id: string; + post_id: string; +}; + +export class CollectionPostRemoved { + data: CollectionPostRemovedData; + timestamp: Date; + type = 'CollectionPostRemoved' as const; + + constructor(data: CollectionPostRemovedData, timestamp: Date) { + this.data = data; + this.timestamp = timestamp; + } + + static create(data: CollectionPostRemovedData, timestamp = new Date()) { + return new CollectionPostRemoved(data, timestamp); + } +} diff --git a/ghost/collections/src/index.ts b/ghost/collections/src/index.ts index 8423909fdf..af417d2388 100644 --- a/ghost/collections/src/index.ts +++ b/ghost/collections/src/index.ts @@ -4,3 +4,5 @@ export * from './Collection'; export * from './events/PostAddedEvent'; export * from './events/PostEditedEvent'; export * from './events/TagDeletedEvent'; +export * from './events/CollectionPostAdded'; +export * from './events/CollectionPostRemoved';