Browse Source

Bugfix/not found status in benchmarks endpoints (#8331)

* Fix not found status

* Update changelog
pull/8313/head
Thomas Kaul 4 hours ago
committed by GitHub
parent
commit
837d0e9c75
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 34
      apps/api/src/app/endpoints/benchmarks/benchmarks.controller.ts

1
CHANGELOG.md

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed the double submission of forms in the account detail dialog, the create or update access dialog, the historical market data editor, the import activities dialog, the coupon system and the create asset profile dialog of the admin control panel
- Fixed an issue where users could grant a private access to themselves
- Fixed the status code of the endpoints to add and delete a benchmark if the asset profile does not exist
## 3.93.0 - 2026-10-25

34
apps/api/src/app/endpoints/benchmarks/benchmarks.controller.ts

@ -30,7 +30,7 @@ import {
UseInterceptors
} from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { DataSource } from '@prisma/client';
import { DataSource, SymbolProfile } from '@prisma/client';
import { StatusCodes, getReasonPhrase } from 'http-status-codes';
import { BenchmarksService } from './benchmarks.service';
@ -51,11 +51,19 @@ export class BenchmarksController {
public async addBenchmark(
@Body() { dataSource, symbol }: AssetProfileIdentifier
) {
let benchmark: Partial<SymbolProfile> | null;
try {
const benchmark = await this.benchmarkService.addBenchmark({
benchmark = await this.benchmarkService.addBenchmark({
dataSource,
symbol
});
} catch {
throw new HttpException(
getReasonPhrase(StatusCodes.INTERNAL_SERVER_ERROR),
StatusCodes.INTERNAL_SERVER_ERROR
);
}
if (!benchmark) {
throw new HttpException(
@ -65,12 +73,6 @@ export class BenchmarksController {
}
return benchmark;
} catch {
throw new HttpException(
getReasonPhrase(StatusCodes.INTERNAL_SERVER_ERROR),
StatusCodes.INTERNAL_SERVER_ERROR
);
}
}
@Delete(':dataSource/:symbol')
@ -80,11 +82,19 @@ export class BenchmarksController {
@Param('dataSource') dataSource: DataSource,
@Param('symbol') symbol: string
) {
let benchmark: Partial<SymbolProfile> | null;
try {
const benchmark = await this.benchmarkService.deleteBenchmark({
benchmark = await this.benchmarkService.deleteBenchmark({
dataSource,
symbol
});
} catch {
throw new HttpException(
getReasonPhrase(StatusCodes.INTERNAL_SERVER_ERROR),
StatusCodes.INTERNAL_SERVER_ERROR
);
}
if (!benchmark) {
throw new HttpException(
@ -94,12 +104,6 @@ export class BenchmarksController {
}
return benchmark;
} catch {
throw new HttpException(
getReasonPhrase(StatusCodes.INTERNAL_SERVER_ERROR),
StatusCodes.INTERNAL_SERVER_ERROR
);
}
}
@Get()

Loading…
Cancel
Save