Skip to content

feature/job fixes#230

Merged
sfreeman422 merged 6 commits intomasterfrom
feature/job-fixes
Apr 1, 2026
Merged

feature/job fixes#230
sfreeman422 merged 6 commits intomasterfrom
feature/job-fixes

Conversation

@sfreeman422
Copy link
Copy Markdown
Collaborator

@sfreeman422 sfreeman422 commented Apr 1, 2026

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:

  • Added a new script (run-fun-fact-job.ts) to run the fun-fact job independently, including database connection and environment validation, and integrated it into package.json scripts and VSCode launch configurations for easier local debugging and execution. [1] [2] [3] [4]
  • Updated documentation to instruct developers to use .env.example files as templates for backend and frontend configuration. [1] [2]
  • Added a comprehensive .env.example for the backend, documenting all required and optional environment variables.

TypeORM Entity Resolution Improvements:

  • Added a utility (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:

  • Updated quote-fetching logic to support the new ZenQuotes API response format, while maintaining backward compatibility with the legacy format. Adjusted tests accordingly. [1] [2] [3] [4] [5]

Logging Enhancements:

  • Improved logger serialization to safely handle circular references, include additional error metadata (such as code and status), and exclude large Axios request/response objects from logs. [1] [2] [3] [4] [5]

Other Minor Improvements:

  • Added a custom User-Agent header to Wikipedia API requests for better identification and compliance.

Copilot AI review requested due to automatic review settings April 1, 2026 13:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

sfreeman422 and others added 3 commits April 1, 2026 09:49
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>
@sfreeman422 sfreeman422 merged commit 88f4866 into master Apr 1, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants