0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00
Commit graph

37865 commits

Author SHA1 Message Date
Naz
9c9afc934f Added dependency to @tryghost/ghost
- The legacy ghost/core code was missing an explicit dependency to the NestJS package
2024-01-22 11:11:34 +07:00
Naz
df1f9e8a5c Fixed count query in snippets bookshelf repository
refs https://github.com/TryGhost/Arch/issues/99

- Added naive version of the count method using bookshelf models metadata. We aim to use knex anyway, so this is just to get the tests passing
2024-01-22 11:11:34 +07:00
Fabien "egg" O'Carroll
98ea0b1ac3 Enabled add and read 2024-01-22 11:11:34 +07:00
Fabien "egg" O'Carroll
e3713b549a Added exception handling 2024-01-22 11:11:34 +07:00
Fabien "egg" O'Carroll
fbce8c2a52 Fixed location header interceptor 2024-01-22 11:11:34 +07:00
Fabien "egg" O'Carroll
51546d8d5f Moved interceptors 2024-01-22 11:11:34 +07:00
Fabien "egg" O'Carroll
247bae2169 Disabled routes while in dev 2024-01-22 11:11:34 +07:00
Fabien "egg" O'Carroll
000e1e5048 Added defaults to DTO 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
ded18049b0 Wired up read&add to Admin API 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
1abc99cab3 Added add method for snippets controller
We force the updatedAt here because there is a bug in the original API
2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
e1d2905d21 Added initial interceptor for location headers 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
474dec08b3 Updated Entity to handle dates and defaults 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
a7d20dbe61 Added support for deleting entities
We need to improve DX here, shouldn't need to pass `deleted` property
2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
d54e7053ff Refactor BaseKnexRepository into separate file 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
8601f68347 Refactor sentry handling into base class 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
a4345afb82 Initial refactor for base repository 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
b65b4cb057 Refactored entity -> row mapping 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
0431ab64e0 Formatting 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
c37d6bf2eb Refactored getAll & getSome shared code 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
3c2939c8a9 Refactored row -> entity mapping 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
323e102def Switched to knex repository 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
12e192cdae Added knex to NestJS DI Container 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
6f9ae37706 Added initial knex repository 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
f8f58c9dd8 Installed deps for knex repository 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
166a29b1ed Updated in memory repository 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
af21a1104a Added generic repository, and updated SnippetRepository to use it 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
d6ac611550 Updated pagination type 2024-01-22 11:11:33 +07:00
Naz
b457eb57b0 Added real pagination to GET /snippets endpoint
refs https://github.com/TryGhost/Arch/issues/99

- This is a naive implementation mostly based on existing bookshelf approach. It's up for discussion if doing aggregation inside of the browse method is a right call or this data should be separated into a different method
- To reiterate, the aim for initial spike is to make the cod work using nest and figure out better patterns iteratively while it's fresh.
2024-01-22 11:11:33 +07:00
Naz
b116262083 Fixed source map generation in ghost/ghost project
- It was not enabled by default and caused problems when debugging
2024-01-22 11:11:33 +07:00
Naz
12ad019447 Added 100% test coverage to controller and dto
refs https://github.com/TryGhost/Arch/issues/99

- We aim to keep test coverage close to 100% on all new code. This change adds full coverage to controller layer code
2024-01-22 11:11:33 +07:00
Naz
e6865ee6f0 Removed dead test 2024-01-22 11:11:33 +07:00
Naz
200aaacf42 Removed timezone-related code
refs https://github.com/TryGhost/Arch/issues/99

- The timezone formatting was dropped from the migrated implementation because we do not do the formatting in the legacy API  (incorrectly imo). We only do the timezone formatting on Posts API endpoints.
- Adding formatting for migrated Snippets API would mean a breaking change, which we don't want to make just yet
2024-01-22 11:11:33 +07:00
Naz
df82ab0e5f Removed unnecessary date formatting
refs https://github.com/TryGhost/Arch/issues/99

- Only posts resources ever have the dates formatted in the legacy API. There's no need to implement this formatting in Snippets API at the moment
2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
ce5cfb742f [WIP] Initial timezone interceptor 2024-01-22 11:11:33 +07:00
Fabien "egg" O'Carroll
058d95bdc2 Fixed controller tests 2024-01-22 11:11:33 +07:00
Naz
803f8ee3f1 Added snippet controller implementation to pass e2e tests
refs https://github.com/TryGhost/Arch/issues/99

- This is a very crude implementation that showcases moving pieces that are needed to make Snippets API work with NestJS
- The snippets api e2e test suite enables the `nestSnippetsAPI` flag to allow testing nest implementation of the GET /snippets endpoint
2024-01-22 11:11:33 +07:00
Naz
8eb9ba9616 Added bookshelf snippets repository implementation
refs https://github.com/TryGhost/Arch/issues/99

- The Snippets repository allows to fetch Snippet entity data through the legacy bookshelf models. The bookshelf should be substituted with knex wherever possible, once we have reached the feature parity and stability with the legacy Snippets API.
2024-01-22 11:11:33 +07:00
Naz
486aab2e01 Added settings cache injection to SnippetsController
refs https://github.com/TryGhost/Arch/issues/99

- The "timezone" value will be needed to format the dates  in the Snippet response according to out API rules
2024-01-22 11:11:33 +07:00
Naz
cbb6a7cae2 Injected settings-cache into Nest app
refs https://github.com/TryGhost/Arch/issues/99

- Nest app needs access to settings (timezone for now)
2024-01-22 11:11:33 +07:00
Naz
cd2175f99f Have put the GET /snippets endpoint behind feature flag
refs https://github.com/TryGhost/Arch/issues/100

- Because of the way how new NestJS code is integrated into existing Ghost I've introduced a way to "skip" rather than "block" access to certain API endpoints when the labs flag is enabled.
- This change skips the `GET /snippets` legacy Admin API route and falls through to the NestJS route
2024-01-22 11:11:33 +07:00
Naz
c45b28edc1 Added an alpha flag for Nest migration
refs https://github.com/TryGhost/Arch/issues/100

- Added a `nestSnippetsAPI` flag to control the rollout of the Snippets API migration to NestJS and new architecture
2024-01-22 11:11:31 +07:00
Fabien "egg" O'Carroll
1b39abdcb4 Fixed types 2024-01-22 11:10:35 +07:00
Naz
b6dae2c383 Fixed breaking build after entity renames 2024-01-22 11:10:35 +07:00
Fabien "egg" O'Carroll
76cc218928 Started on base Entity class 2024-01-22 11:10:35 +07:00
Naz
71495ed22f Added minimal repository structure for Snippets
refs https://github.com/TryGhost/Arch/issues/99

- Adds connection between snippets in NestJS application to the models in the legacy Ghost codebase to link snippets to real data
- The NestJS controller code can be executed by commenting out `router.get('/snippets', mw.authAdminApi, http(api.snippets.browse));` in the ghost core Admin API routes file
2024-01-22 11:10:35 +07:00
Naz
7e152e638f Basic controller/service setup for Snippets API
refs https://github.com/TryGhost/Arch/issues/99

- This is scaffolding for the Snippets API controller
- The change includes a basic controller, service and a test to get the ball rolling
2024-01-22 11:10:33 +07:00
Naz
8778ba9f8d Added ESlint ignore rule to allow dotted filenames
- In the Nest code we are writing an example of the ideal code. The ESlint rules will adjust to how code is written in this project eventually once we experiment with things enough.
- Examples of new naming convention are based on  `.` separator e.g.:
- The middle words represent use cases, could later become pods e.g. posts.controller.js, posts.repository.js, posts.dto.js, posts.service.js, posts.scheduling.service.js, stripe.provider.js, stripe.webhook.listener.js.
2024-01-22 11:09:46 +07:00
Fabien "egg" O'Carroll
529990cadf Fixed order of routes 2024-01-22 11:09:46 +07:00
Fabien "egg" O'Carroll
671346dc15 [WIP] Adding Snippet stuff 2024-01-22 11:09:46 +07:00
Fabien "egg" O'Carroll
7ec8154331 Add models to DI container 2024-01-22 11:09:46 +07:00