Skip to content

feat(apps/server/server-rest): logging & cors#102

Merged
99mini merged 8 commits intomainfrom
server-rest/logging
Jun 19, 2025
Merged

feat(apps/server/server-rest): logging & cors#102
99mini merged 8 commits intomainfrom
server-rest/logging

Conversation

@99mini
Copy link
Copy Markdown
Owner

@99mini 99mini commented Jun 19, 2025

No description provided.

@99mini 99mini self-assigned this Jun 19, 2025
Copilot AI review requested due to automatic review settings June 19, 2025 09:49
Copy link
Copy Markdown
Contributor

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 enhances observability by integrating a centralized console-logger, adds caching/rate-limit guards for external APIs, and tightens CORS settings.

  • Introduced LogMetadata decorators on controllers and a global LoggingInterceptor for structured request logging.
  • Implemented ApiCacheService and GithubApiService to cache WakaTime/GitHub data and respect API rate limits.
  • Updated main.ts to configure console-logger and extend CORS origins.

Reviewed Changes

Copilot reviewed 34 out of 35 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
apps/server/rest/src/main.ts Configures console-logger and extends CORS rules
apps/server/rest/src/common/common.module.ts Registers global logging interceptor and API module
apps/server/rest/src/common/services/api-cache.service.ts Implements cache wrapper with delay logic
apps/server/rest/src/common/services/github-api.service.ts Wraps GitHub GraphQL/REST calls with rate checks
apps/server/rest/src/common/interceptors/logging.interceptor.ts Adds basic request/response timing logs
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

apps/server/rest/src/common/common.module.ts:26

  • Exporting ApiModule instead of its providers may confuse consumers. Consider exporting the services (ApiCacheService, GithubApiService) directly or re-exporting the module in app.module.ts.
  exports: [ServerlessProxyService, ApiModule],

Comment thread apps/server/rest/src/main.ts Outdated
@@ -0,0 +1,28 @@
import { applyDecorators } from '@nestjs/common';
Copy link

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

The LogRoute decorator is imported in health.controller.ts but never applied to any method. Consider removing the unused decorator or applying it where needed.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,59 @@
import { Observable } from 'rxjs';
Copy link

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

The AdvancedLoggingInterceptor is implemented but not registered in CommonModule. Register it via APP_INTERCEPTOR or remove it if unused.

Copilot uses AI. Check for mistakes.

import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';

import { log } from '@99mini/console-logger';
Copy link

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

[nitpick] The interceptor uses log(...) but elsewhere code uses info(...)/error(...). Align on one log level API for consistency.

Suggested change
import { log } from '@99mini/console-logger';
import { info } from '@99mini/console-logger';

Copilot uses AI. Check for mistakes.
@99mini 99mini merged commit 2d37200 into main Jun 19, 2025
1 check passed
@99mini 99mini deleted the server-rest/logging branch June 19, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants