Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into e2e-tests
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
#	package.json
  • Loading branch information
sleidig committed Feb 27, 2024
2 parents 6dba2b0 + 9732920 commit c27fc8f
Show file tree
Hide file tree
Showing 16 changed files with 150 additions and 205 deletions.
300 changes: 122 additions & 178 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 8 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"@nestjs/platform-express": "^10.3.3",
"@nestjs/schedule": "4.0.1",
"@ntegral/nestjs-sentry": "^4.0.1",
"@sentry/node": "^7.101.0",
"@sentry/node": "^7.102.1",
"@sentry/tracing": "^7.102.1",
"js-yaml": "4.1.0",
"reflect-metadata": "^0.1.14",
"rimraf": "^3.0.2",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"uuid": "9.0.1"
},
Expand All @@ -42,31 +42,25 @@
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/js-yaml": "4.0.9",
"@types/node": "^18.19.15",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.2",
"@types/uuid": "9.0.8",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.56.0",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "29.7.0",
"jest-openapi": "^0.14.2",
"prettier": "^3.2.5",
"rimraf": "^3.0.2",
"supertest": "^6.3.4",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.3.3"
},
"overrides": {
"@ntegral/nestjs-sentry": {
"@nestjs/common": "$@nestjs/common",
"@nestjs/core": "$@nestjs/core",
"@sentry/node": "$@sentry/node"
}
},
"jest": {
"moduleFileExtensions": [
"js",
Expand Down
6 changes: 3 additions & 3 deletions src/couchdb/couch-db-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,15 @@ export class CouchDbClient {
return headers['etag'].replaceAll('"', '');
}
}),
catchError((err) => {
catchError(() => {
return of(undefined);
}),
);
}

private handleError(err: any) {
console.error(err);

if (err.response?.status === 401) {
throw new UnauthorizedException();
}
Expand All @@ -140,8 +142,6 @@ export class CouchDbClient {
if (err.response?.status === 404) {
throw new NotFoundException();
}

console.error(err);
throw new InternalServerErrorException();
}
}
1 change: 1 addition & 0 deletions src/notification/controller/webhook.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class WebhookController {

@Get()
fetchWebhooksOfUser(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@Headers('Authorization') token: string,
): Observable<WebhookDto[]> {
return this.webhookStorage.fetchAllWebhooks('user-token').pipe(
Expand Down
1 change: 1 addition & 0 deletions src/notification/storage/webhook-storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class WebhookStorage {
* Get all registered webhooks subscribe by the user authenticated with the given token
* @param token
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
fetchAllWebhooks(token?: string): Observable<Webhook[]> {
return this.webhookRepository
.fetchAllWebhooks()
Expand Down
4 changes: 2 additions & 2 deletions src/report-changes/core/report-change-detector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export class ReportChangeDetector {
}

affectsReport(doc: DocChangeDetails): boolean {
// TODO: consider removing the ReportChangeDetector class completely:
// do all query parsing in ReportSchemaGenerator and implement the conditions directly in ReportChangesService?
// TODO: consider removing the ReportChangeDetector class completely:
// do all query parsing in ReportSchemaGenerator and implement the conditions directly in ReportChangesService?
const entityType = doc.change.id.split(':')[0];
if (!this.sqlTableNames.includes(entityType)) {
return false;
Expand Down
1 change: 1 addition & 0 deletions src/report-changes/core/report-changes.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { CreateReportCalculationUseCase } from '../../report/core/use-cases/crea
import { DatabaseChangeResult } from '../storage/database-changes.service';

describe('ReportChangesService', () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let service: ReportChangesService;
let mockNotificationService: Partial<NotificationService>;

Expand Down
4 changes: 3 additions & 1 deletion src/report-changes/core/report-changes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class ReportChangesService {
.activeReports()
.subscribe((reports: Reference[]) => {
reports.forEach((r) => this.registerReportMonitoring(r));
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const [id, monitor] of this.reportMonitors.entries()) {
if (!reports.some((r) => r.id === id)) {
this.reportMonitors.delete(id);
Expand Down Expand Up @@ -104,6 +105,7 @@ export class ReportChangesService {
): Observable<ReportDataChangeEvent[]> {
const affectedReports: Observable<ReportDataChangeEvent>[] = [];

// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const [reportId, changeDetector] of this.reportMonitors.entries()) {
if (!changeDetector.affectsReport(docChange)) {
continue;
Expand Down Expand Up @@ -165,7 +167,7 @@ export class ReportChangesService {
({
report: result.report,
calculation: result,
} as ReportDataChangeEvent),
}) as ReportDataChangeEvent,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('ReportCalculationController', () => {
{
provide: ConfigService,
useValue: {
getOrThrow: jest.fn((key) => {
getOrThrow: jest.fn(() => {
return 'foo';
}),
},
Expand Down
2 changes: 1 addition & 1 deletion src/report/controller/report-calculation.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ReportCalculationController {
@Headers('Authorization') token: string,
@Param('reportId') reportId: string,
): Observable<Reference> {
return this.reportStorage.fetchReport(new Reference(reportId), token).pipe(
return this.reportStorage.fetchReport(new Reference(reportId)).pipe(
switchMap((value) => {
if (!value) {
throw new NotFoundException();
Expand Down
2 changes: 1 addition & 1 deletion src/report/controller/report.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('ReportController', () => {
{
provide: ConfigService,
useValue: {
getOrThrow: jest.fn((key) => {
getOrThrow: jest.fn(() => {
return 'foo';
}),
},
Expand Down
2 changes: 1 addition & 1 deletion src/report/repository/report-repository.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('ReportRepositoryService', () => {
{
provide: ConfigService,
useValue: {
getOrThrow: jest.fn((key) => {
getOrThrow: jest.fn(() => {
return 'foo';
}),
},
Expand Down
2 changes: 2 additions & 0 deletions src/report/repository/report-repository.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export class ReportRepository {
}

private handleError(err: any) {
console.error(err);

if (err.response.status === 401) {
throw new UnauthorizedException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/report/storage/reporting-storage.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('DefaultReportStorage', () => {
{
provide: ConfigService,
useValue: {
getOrThrow: jest.fn((key) => {
getOrThrow: jest.fn(() => {
return 'foo';
}),
},
Expand Down
2 changes: 1 addition & 1 deletion src/report/tasks/report-calculation-processor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class ReportCalculationProcessor {
),
);
}),
catchError((err, caught) => {
catchError((err) => {
console.log(err);
return of();
}),
Expand Down
2 changes: 1 addition & 1 deletion src/report/tasks/report-calculation-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class ReportCalculationTask {
throw err;
}),
)
.subscribe((_) => {
.subscribe(() => {
this.logger.log('done');
});
}
Expand Down

0 comments on commit c27fc8f

Please sign in to comment.