Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR focuses on fixing and hardening the backend “fun-fact” job execution and related operational tooling, including safer structured logging and easier environment setup for local/dev runs.
Changes:
- Added a standalone CLI runner + npm scripts/VS Code launch config for executing the fun-fact job on demand.
- Improved job robustness by updating external API integrations (ZenQuotes payload handling + Wikipedia User-Agent header) and adjusting constants/tests accordingly.
- Introduced safer JSON logging serialization and centralized TypeORM entity path resolution.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents copying checked-in .env.example files for backend/frontend setup. |
| packages/backend/src/shared/logger/logger.ts | Adds safeStringify + filters noisy meta keys and uses safer serialization in log output. |
| packages/backend/src/shared/db/typeorm-options.ts | Adds helper to resolve TypeORM entity globs (env + defaults). |
| packages/backend/src/jobs/run-fun-fact-job.ts | New one-off runner to connect DB and execute FunFactJob via ts-node. |
| packages/backend/src/jobs/fun-fact.job.ts | Updates quote API parsing (ZenQuotes + legacy) and adds Wikipedia request header. |
| packages/backend/src/jobs/fun-fact.job.spec.ts | Updates/extends tests for new quote payload handling. |
| packages/backend/src/jobs/fun-fact.const.ts | Updates Quote URL and adjusts API Ninjas URL. |
| packages/backend/src/index.ts | Uses new entity resolver and stops requiring TYPEORM_ENTITIES in env checks. |
| packages/backend/package.json | Adds job:fun-fact script. |
| packages/backend/.env.example | Adds a checked-in backend env example file. |
| package.json | Adds workspace-level job:fun-fact script proxy. |
| .vscode/launch.json | Adds a debug configuration for the fun-fact job runner. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and new features to the backend job infrastructure, particularly for the "fun-fact" job, along with enhancements to environment configuration, logging, and developer experience. The main changes include adding a dedicated script and launch configuration for running the fun-fact job, improving TypeORM entity resolution, updating environment variable handling, enhancing logging robustness, and updating the quote-fetching logic to support a new API.
Key changes:
Fun-fact Job Infrastructure & Developer Experience:
run-fun-fact-job.ts) to run the fun-fact job independently, including database connection and environment validation, and integrated it intopackage.jsonscripts and VSCode launch configurations for easier local debugging and execution. [1] [2] [3] [4].env.examplefiles as templates for backend and frontend configuration. [1] [2].env.examplefor the backend, documenting all required and optional environment variables.TypeORM Entity Resolution Improvements:
resolveTypeOrmEntities) to dynamically resolve TypeORM entity paths, reducing manual configuration and improving compatibility with both source and built files. Updated backend initialization and job runner to use this utility. [1] [2] [3] [4]Fun-fact Job API & Logic Updates:
Logging Enhancements:
codeandstatus), and exclude large Axios request/response objects from logs. [1] [2] [3] [4] [5]Other Minor Improvements:
User-Agentheader to Wikipedia API requests for better identification and compliance.