diff --git a/server/source/dto/create-source.dto.ts b/server/source/dto/create-source.dto.ts index 45469b3b2..d42cf5397 100644 --- a/server/source/dto/create-source.dto.ts +++ b/server/source/dto/create-source.dto.ts @@ -35,4 +35,9 @@ export class CreateSourceDTO { @IsString() @ApiProperty() recaptcha: string; + + @IsString() + @IsOptional() + @ApiProperty() + targetId: string; } diff --git a/server/source/source.controller.ts b/server/source/source.controller.ts index 719a34f8f..1c37f9ed4 100644 --- a/server/source/source.controller.ts +++ b/server/source/source.controller.ts @@ -48,8 +48,11 @@ export class SourceController { } @ApiTags("source") - @Get("api/source/:targetId") - public async getSourcesClaim(@Param() params, @Query() getSources: any) { + @Get("api/source/target/:targetId") + public async getSourcesByTargetId( + @Param() params, + @Query() getSources: any + ) { const { targetId } = params; const { page, order } = getSources; const pageSize = parseInt(getSources.pageSize, 10); diff --git a/server/tests/source.e2e.spec.ts b/server/tests/source.e2e.spec.ts index bcdbad104..dd9f7ad21 100644 --- a/server/tests/source.e2e.spec.ts +++ b/server/tests/source.e2e.spec.ts @@ -93,9 +93,9 @@ describe("SourceController (e2e)", () => { }); }); - it("/api/source/:targetId (GET) - Should get sources by targetId", () => { + it("/api/source/target/:targetId (GET) - Should get sources by targetId", () => { return request(app.getHttpServer()) - .get(`/api/source/${targetId}`) + .get(`/api/source/target/${targetId}`) .query({ page: 0, order: "asc", diff --git a/src/api/sourceApi.ts b/src/api/sourceApi.ts index 2831ce15f..235f965c1 100644 --- a/src/api/sourceApi.ts +++ b/src/api/sourceApi.ts @@ -23,7 +23,7 @@ const getByTargetId = (options: optionsType) => { language: options?.i18n?.languages[0], }; return request - .get(`${options.targetId}`, { params }) + .get(`/target/${options.targetId}`, { params }) .then((response) => { const { sources, totalPages, totalSources } = response.data; return {