Commit Graph

17 Commits

Author SHA1 Message Date
Fabien "egg" O'Carroll
917ab0a79e Added CollectionRepository
This defines the interface required by the CollectionsService
2023-06-01 14:25:49 +07:00
Fabien "egg" O'Carroll
5282c4a72b Update eslint and c8 to support using TS interfaces
This will allow us to define the repository interface
2023-06-01 14:25:49 +07:00
Naz
a0c36e16d0 Added "addPost" method do collections module
refs https://github.com/TryGhost/Team/issues/3260

- The method allows to append individual posts to the collection
2023-06-01 14:25:49 +07:00
Naz
87df8754ee Moved bookshelf posts repository to core
refs https://github.com/TryGhost/Team/issues/3260

- Moved the posts bookshelf repository into core codebase where it should belong.
2023-05-31 22:55:35 +07:00
Naz
66d489b8b3 Added Posts relation support to collections package
refs https://github.com/TryGhost/Team/issues/3260

- Adds "posts" relation to Collection entity to manage posts belonging to the collection
2023-05-31 22:55:35 +07:00
Fabien "egg" O'Carroll
b58dac262e Updated collections package to use .d.ts for external lib types
Rather than using `require` we can add a type definition file, this allows us
to add custom types in the future if we want. We need to add some config for
ts-node to pick up the types correctly.
2023-05-24 12:47:20 -04:00
Naz
258a562031
Fixed linting error
refs fdd73d01b7
2023-05-24 17:31:14 +07:00
Naz
4cb5cc9087
Added default collection values
refs https://github.com/TryGhost/Team/issues/3259

- For collection entity creation consistency have set defaults
2023-05-24 17:01:28 +07:00
Naz
b52ec948b0
Added property mapper to collections responses
closes https://github.com/TryGhost/Team/issues/3259

- API output mappers (soon to be serializers) are meant to work based on allowlist set of output properties. Having the allowlist early on will allow to track the API evolution consistently.
2023-05-24 17:01:28 +07:00
Naz
fdd73d01b7
Refactored collections entity logic
refs https://github.com/TryGhost/Team/issues/3294

- The factory method for the Collection and validations should live close together based on our latest architectural direction
2023-05-24 17:01:28 +07:00
Naz
735edf5f87 Fixed editing unexistent collection behavior
refs https://github.com/TryGhost/Team/issues/3167

- When editing collection that does not exist the API should be returning a 404 instead of creating a new collection
2023-05-19 20:42:46 +07:00
Naz
7d926dd30b Refactored collections unit test suite
refs https://github.com/TryGhost/Team/issues/3167

- Duplicate service initialization was getting annoying
2023-05-19 20:42:46 +07:00
Naz
606bd383f1 Extended getAll method with paging metadata
refs https://github.com/TryGhost/Team/issues/3167

- Having paging metadata is part of every API response and was missing from initial implementation
- The getAll method has all of the values as "static" as there's nothing to page on.
2023-05-19 20:42:46 +07:00
Naz
2d1eb881fc Extended save method to return saved collection data
refs https://github.com/TryGhost/Team/issues/3167

- The core client (API) needs a way to pass in information without an ID when creating a new entity, handling it on service/repository layer makes the most sense.
- Used "require" syntax to import tpl/errors modules, otherwise TS compiler was complaining about type compatibility issues, this works as a temporary workaround and is tracked and an issue to improve in the future.
2023-05-19 20:42:46 +07:00
Naz
d4a5dac758 Exposed in-memory collections repository
refs https://github.com/TryGhost/Team/issues/3167

- The repository is needed when initializing the collections service from the core
2023-05-19 20:42:46 +07:00
Naz
2a16b1427d
Removed stray tsconfig.tsbuildinfo file
refs 69ce97268e

- This file should not have gotten into the source code from the get co
2023-05-16 13:08:57 +07:00
Naz
4e2a00b6e6 Added a collections package with CRUD logic
closes https://github.com/TryGhost/Team/issues/3166

- The collections service contains CRUD logic to manage collection entities through: save, getById, getAll, and destroy methods.
2023-05-16 12:21:31 +07:00