Commit Graph

10 Commits

Author SHA1 Message Date
Naz
99f29a169c Removed post delete related event handling
closes https://github.com/TryGhost/Arch/issues/91

- We have on cascade delete (a9f9f6121a/ghost/core/core/server/data/schema/schema.js (L1068)) on `post_id` column which handles post deletion logic automatically on DB level.
- The commented out handlers in the long term should be hooked up with public CollectionService methods on the client side.
2023-09-15 13:50:25 +08:00
Naz
cb532ea819 Fixed tag.deleted event mapping
https://github.com/TryGhost/Arch/issues/90

- When a tag.deleted event is emitted the original 'data' object does not contain an 'id' property. The logic in collections service assumes the id would be present to update the collections efficiently.
2023-09-14 14:31:23 +08:00
Naz
1d7bb44a94 Fixed post.deleted event mapping
https://github.com/TryGhost/Arch/issues/90

- When a post.deleted event is emitted the original 'data' object does not contain an 'id' property. The logic in collections service assumes the id would be present to update the collections efficiently.
2023-09-14 14:31:23 +08:00
Fabien "egg" O'Carroll
8d71841918 Mapped tag.deleted event to TagDeletedEvent
refs https://github.com/TryGhost/Arch/issues/61

Because the tags system is still written in the old way, the tag.deleted
bookshelf event needs to be mapped to the DomainEvents to bridge the gap with
the collections package.
2023-07-26 12:54:42 +02:00
Fabien "egg" O'Carroll
90f92ab2a4 Fixed usage of require in test file
We should be using the import syntax instead of require in our TypeScript files.
2023-07-26 12:54:42 +02:00
Naz
694ab1d32d Added support for expansions in collection filters
refs https://github.com/TryGhost/Arch/issues/46

- Similarly to post filters, collection filters now support both 'tag' and 'tags' nql filter keys when defining a filter for related tag slugs. For example, both `tag:avocado` and `tags:avocado` would both be valid collection filters that would filter by the same 'slug' property of the tags assigned to a post.
- Along with these changes had to rework the tags property of the collection posts to match the shape used in post resources. Moved from:
`tags: ['bacon', 'broc']`
to
`tags:[{slug: 'bacon'}, {slug: 'broc'}]`
2023-07-25 19:01:56 +08:00
Naz
04c92d2ca5 Removed CollectionResourceChangeEvent handling
refs https://github.com/TryGhost/Arch/issues/16

- The generic "UpdateAllCollections" logic should not be used as the mapped Post's delete/add/edit events should be sufficient in maintaining collection's state
2023-07-21 19:46:22 +08:00
Naz
eec610dc53 Added collection handling for post's tag attach events
refs https://github.com/TryGhost/Arch/issues/41

- When a tag is attached or detached to the post automatic collections matching  the tag filter should be updated.
2023-07-18 18:36:49 +08:00
Naz
87d644ef88
Cleaned up commented out debug code
refs a547ae4b68
2023-07-03 18:58:17 +08:00
Naz
e22d8e8680 Extracted model event interceptor to separate package
refs https://github.com/TryGhost/Ghost/pull/17065

- This is a follow up cleanup work after introducing even mapper when working on collections refresh mechanism.
- This module manages interception of the Model events and maps/dispatches Domain events that could later be used in different libraries.
2023-07-03 18:47:27 +08:00