Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
test:
name: Run Tests
needs: lint-and-build
if: false # Tests disabled
runs-on: ubuntu-latest

services:
Expand Down Expand Up @@ -97,7 +96,7 @@ jobs:

deploy-staging:
name: Deploy to Staging
needs: lint-and-build
needs: [lint-and-build, test]
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
runs-on: ubuntu-latest
environment: staging
Expand All @@ -112,7 +111,7 @@ jobs:

deploy-production:
name: Deploy to Production
needs: lint-and-build
needs: [lint-and-build, test]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
environment: production
Expand Down
2 changes: 0 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file removed props_errors.txt
Empty file.
26 changes: 26 additions & 0 deletions src/analytics/analytics.interceptor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Injectable, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
import { AnalyticsService } from './analytics.service';

@Injectable()
export class AnalyticsInterceptor implements NestInterceptor {
constructor(private readonly analytics: AnalyticsService) {}

intercept(context: ExecutionContext, next: CallHandler): Observable<any> {

Check warning on line 10 in src/analytics/analytics.interceptor.ts

View workflow job for this annotation

GitHub Actions / Lint & Build

Unexpected any. Specify a different type
const req = context.switchToHttp().getRequest();
const res = context.switchToHttp().getResponse();
const start = Date.now();

return next.handle().pipe(
tap(() => {
this.analytics.record({
endpoint: req.path,
method: req.method,
statusCode: res.statusCode,
responseTime: Date.now() - start,
});
}),
);
}
}
Loading
Loading