From 2a450ad0c6d18a953ca6b93df7a9f97fbb87bdb5 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 19 Sep 2024 12:12:59 +0200 Subject: [PATCH] fix: resolved ApiParam inconsistencies and corrected TypeScript-Angular generator name in openapi-generator (#1426) --- ...fig.json => typescript-angular-config.json} | 0 .github/workflows/release-and-publish-sdk.yml | 10 +++++----- .github/workflows/upload-sdk-artifact.yml | 4 ++-- src/samples/samples.controller.ts | 18 +++++++++--------- 4 files changed, 16 insertions(+), 16 deletions(-) rename .github/openapi/{typescript-config.json => typescript-angular-config.json} (100%) diff --git a/.github/openapi/typescript-config.json b/.github/openapi/typescript-angular-config.json similarity index 100% rename from .github/openapi/typescript-config.json rename to .github/openapi/typescript-angular-config.json diff --git a/.github/workflows/release-and-publish-sdk.yml b/.github/workflows/release-and-publish-sdk.yml index 4228642e6..9a79e592f 100644 --- a/.github/workflows/release-and-publish-sdk.yml +++ b/.github/workflows/release-and-publish-sdk.yml @@ -131,7 +131,7 @@ jobs: - start-backend-export-swagger strategy: matrix: - generator: [python, python-pydantic-v1, typescript] + generator: [python, python-pydantic-v1, typescript-angular] steps: - name: Checkout repository @@ -152,7 +152,7 @@ jobs: --git-repo-id scicat-backend-next \ --git-user-id SciCatProject \ -o ./sdk/${{ matrix.generator }} $( - if [ "${{ matrix.generator }}" == "typescript" ]; then + if [ "${{ matrix.generator }}" == "typescript-angular" ]; then echo "--additional-properties=npmVersion=${{ needs.build-release.outputs.new_tag}}"; elif [ "${{ matrix.generator }}" == "python" ]; then echo "--additional-properties=packageVersion=${{ needs.build-release.outputs.new_tag}}"; @@ -183,10 +183,10 @@ jobs: node-version: ${{ env.NODE_VERSION }} registry-url: "https://registry.npmjs.org/" - - name: Download TypeScript SDK Artifact + - name: Download TypeScript Angular SDK Artifact uses: actions/download-artifact@v4 with: - name: sdk-typescript-${{github.sha}} + name: sdk-typescript-angular-${{github.sha}} path: ./sdk - name: Publish package @@ -194,7 +194,7 @@ jobs: npm install npm run build npm publish --access public - working-directory: ./sdk/typescript/ + working-directory: ./sdk/typescript-angular/ env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/upload-sdk-artifact.yml b/.github/workflows/upload-sdk-artifact.yml index cbce35fc4..369426a08 100644 --- a/.github/workflows/upload-sdk-artifact.yml +++ b/.github/workflows/upload-sdk-artifact.yml @@ -48,7 +48,7 @@ jobs: - start-backend-and-upload-swagger-schema strategy: matrix: - generator: [python, typescript, python-pydantic-v1] + generator: [python, typescript-angular, python-pydantic-v1] steps: - name: Checkout repository @@ -67,7 +67,7 @@ jobs: config-file: .github/openapi/${{ matrix.generator }}-config.json command-args: | -o ./sdk/${{ matrix.generator }} $( - if [ "${{ matrix.generator }}" == "typescript" ]; then + if [ "${{ matrix.generator }}" == "typescript-angular" ]; then echo "--additional-properties=npmVersion=${{env.SDK_VERSION}}"; elif [ "${{ matrix.generator }}" == "python" ]; then echo "--additional-properties=packageVersion=${{env.SDK_VERSION}}"; diff --git a/src/samples/samples.controller.ts b/src/samples/samples.controller.ts index 030960896..e5c5feaf7 100644 --- a/src/samples/samples.controller.ts +++ b/src/samples/samples.controller.ts @@ -566,7 +566,7 @@ export class SamplesController { "Returns a boolean indicating whether the user has access to the sample with the specified ID.", }) @ApiParam({ - name: "pid", + name: "id", description: "ID of the sample to check access for", type: String, }) @@ -774,17 +774,17 @@ export class SamplesController { }) async findOneAttachment( @Req() request: Request, - @Param("id") sampleId: string, + @Param("id") id: string, @Param("fk") attachmentId: string, ): Promise { await this.checkPermissionsForSample( request, - sampleId, + id, Action.SampleAttachmentRead, ); return this.attachmentsService.findOne({ id: attachmentId, - sampleId: sampleId, + sampleId: id, }); } @@ -816,17 +816,17 @@ export class SamplesController { }) async findOneAttachmentAndRemove( @Req() request: Request, - @Param("id") sampleId: string, + @Param("id") id: string, @Param("fk") attachmentId: string, ): Promise { await this.checkPermissionsForSample( request, - sampleId, + id, Action.SampleAttachmentDelete, ); return this.attachmentsService.findOneAndDelete({ _id: attachmentId, - sampleId: sampleId, + sampleId: id, }); } @@ -867,7 +867,7 @@ export class SamplesController { }) async findAllDatasets( @Req() request: Request, - @Param("id") sampleId: string, + @Param("id") id: string, ): Promise { const user: JWTUser = request.user as JWTUser; const ability = this.caslAbilityFactory.samplesInstanceAccess(user); @@ -900,7 +900,7 @@ export class SamplesController { } const dataset = await this.datasetsService.fullquery({ - where: { sampleId }, + where: { sampleId: id }, fields: fields, }); return dataset;