diff --git a/apps/pathway-design/server/src/main.ts b/apps/pathway-design/server/src/main.ts index aec46808..a78e3792 100644 --- a/apps/pathway-design/server/src/main.ts +++ b/apps/pathway-design/server/src/main.ts @@ -6,7 +6,6 @@ import { Logger } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; -import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import { AppModule } from './app/app.module'; async function bootstrap() { @@ -15,29 +14,6 @@ async function bootstrap() { app.setGlobalPrefix(globalPrefix); const port = process.env.PORT ?? 3000; - // Setting up Swagger document - const options = new DocumentBuilder() - .setTitle('Pathway Design Application') - .setDescription( - 'Application Programming Interface (API) of Pathway Design Application' - ) - .setVersion('1.0') - .addBearerAuth( - { - description: - 'Please enter token in following format: Bearer ', - name: 'Authorization', - bearerFormat: 'Bearer', - scheme: 'Bearer', - type: 'http', - in: 'Header', - }, - 'access-token' - ) - .build(); - const document = SwaggerModule.createDocument(app, options); - SwaggerModule.setup('api', app, document); - await app.listen(port); Logger.log( `🚀 Application is running on: http://localhost:${port}/${globalPrefix}` diff --git a/apps/pathway-design/server/src/test/initialize-pathway/index.step.ts b/apps/pathway-design/server/src/test/initialize-pathway/index.step.ts index 49a7ec3a..bd72876c 100644 --- a/apps/pathway-design/server/src/test/initialize-pathway/index.step.ts +++ b/apps/pathway-design/server/src/test/initialize-pathway/index.step.ts @@ -50,7 +50,7 @@ class ControllerSteps { } @then('I should retrieve a pathway initialized with its data') - public thenIShouldSeeAPathwayInitiated(dataTable: DataTable) { + public thenIShouldRetrieveAPathwayInitiated(dataTable: DataTable) { const firstRow = dataTable.hashes()[0]; assert.strictEqual(this.response.body.title, firstRow.title); diff --git a/apps/pathway-design/server/webpack.config.js b/apps/pathway-design/server/webpack.config.js index 1e73c265..a51085a5 100644 --- a/apps/pathway-design/server/webpack.config.js +++ b/apps/pathway-design/server/webpack.config.js @@ -15,20 +15,6 @@ module.exports = { optimization: process.env.BUN_ENV === 'production', outputHashing: process.env.BUN_ENV === 'production' ? 'all' : 'none', - transformers: [ - { - name: '@nestjs/swagger/plugin', - options: { - classValidatorShim: true, - dtoFileNameSuffix: [ - '.dto.ts', - '.entity.ts', - '.schema.ts', - ], - introspectComments: true, - }, - }, - ], }), ], }; diff --git a/bun.lockb b/bun.lockb index c5acadee..732ba2a9 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/libs/pathway-design/server/pathway/interface-adapters/src/lib/initialize/controller/initialize-pathway.controller.ts b/libs/pathway-design/server/pathway/interface-adapters/src/lib/initialize/controller/initialize-pathway.controller.ts index f57e56be..22690f57 100644 --- a/libs/pathway-design/server/pathway/interface-adapters/src/lib/initialize/controller/initialize-pathway.controller.ts +++ b/libs/pathway-design/server/pathway/interface-adapters/src/lib/initialize/controller/initialize-pathway.controller.ts @@ -10,17 +10,10 @@ import { UsePipes, ValidationPipe, } from '@nestjs/common'; -import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; import type { InitializePathwayRequestBodyDto } from '../dtos/request/body/index.dto'; import type { InitializedPathwayResponseBodyDto } from '../dtos/response/body/index.dto'; -@ApiTags('Pathway') -@UsePipes( - new ValidationPipe({ - whitelist: true, - forbidNonWhitelisted: true, - }) -) +@UsePipes(new ValidationPipe()) @Controller({ path: 'pathway', }) @@ -31,7 +24,6 @@ export class InitializePathwayController { ) {} @Post('init') - @ApiBearerAuth('access-token') execute( @Body() initializePathwayRequestBodyDto: InitializePathwayRequestBodyDto ): Promise { diff --git a/libs/pathway-design/server/pathway/interface-adapters/src/lib/initialize/dtos/request/body/index.dto.ts b/libs/pathway-design/server/pathway/interface-adapters/src/lib/initialize/dtos/request/body/index.dto.ts index db985a7c..b5988fca 100644 --- a/libs/pathway-design/server/pathway/interface-adapters/src/lib/initialize/dtos/request/body/index.dto.ts +++ b/libs/pathway-design/server/pathway/interface-adapters/src/lib/initialize/dtos/request/body/index.dto.ts @@ -1,15 +1,12 @@ -export class InitializePathwayRequestBodyDto - implements IInitializePathwayRequestBodyDto -{ - readonly title!: string; +import { IsString } from 'class-validator'; - readonly description!: string; +export class InitializePathwayRequestBodyDto { + @IsString() + title!: string; - readonly researchField!: string; -} + @IsString() + description!: string; -export interface IInitializePathwayRequestBodyDto { - description: string; - researchField: string; - title: string; + @IsString() + researchField!: string; } diff --git a/package.json b/package.json index 46049676..7a60e84c 100644 --- a/package.json +++ b/package.json @@ -4,15 +4,12 @@ "@nestjs/core": "^10.0.2", "@nestjs/cqrs": "^10.2.7", "@nestjs/platform-express": "^10.0.2", - "@nestjs/swagger": "^7.4.0", - "@nx/nest": "^19.4.2", "@swc/cli": "^0.4.0", "class-transformer": "^0.5.1", "class-validator": "^0.14.1", "crypto": "^1.0.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.8.0", - "swagger-ui-express": "^5.0.1", "swc-loader": "^0.2.6", "tslib": "^2.3.0" }, @@ -22,12 +19,13 @@ "@cucumber/cucumber": "^10.8.0", "@nestjs/schematics": "^10.0.1", "@nestjs/testing": "^10.0.2", - "@nx/eslint": "19.4.2", - "@nx/js": "19.4.2", - "@nx/node": "19.4.2", - "@nx/web": "19.4.2", - "@nx/webpack": "19.4.2", - "@nx/workspace": "19.4.2", + "@nx/eslint": "19.5.6", + "@nx/js": "19.5.6", + "@nx/nest": "^19.5.6", + "@nx/node": "19.5.6", + "@nx/web": "19.5.6", + "@nx/webpack": "19.5.6", + "@nx/workspace": "19.5.6", "@swc-node/register": "~1.9.1", "@swc/core": "~1.5.7", "@swc/helpers": "~0.5.11", @@ -39,10 +37,10 @@ "chokidar": "^3.6.0", "commitlint": "^19.3.0", "cucumber-tsflow": "^4.4.4", - "nx": "19.4.2", + "nx": "19.5.6", "sinon": "^18.0.0", "supertest": "^7.0.0", - "typescript": "~5.4.2", + "typescript": "~5.5.2", "verdaccio": "^5.0.4", "webpack-cli": "^5.1.4" },