diff --git a/apps/backend/src/story/story.controller.ts b/apps/backend/src/story/story.controller.ts index ced819a14..4fd0d208d 100644 --- a/apps/backend/src/story/story.controller.ts +++ b/apps/backend/src/story/story.controller.ts @@ -44,7 +44,13 @@ export class StoryController { @Param('anthologyId', ParseIntPipe) anthologyId: number, @Param('storyId', ParseIntPipe) storyId: number, ): Promise { - return this.storyService.findOne(storyId); + const story = await this.storyService.findOne(storyId); + + if (!story) { + throw new NotFoundException(`Story with ID ${storyId} not found`); + } + + return story; } @Delete('/:storyId') @@ -54,6 +60,23 @@ export class StoryController { return this.storyService.remove(storyId); } + @Delete('/library/anthology/story/:storyId') + @ApiOperation({ summary: 'Delete a story from a specific anthology' }) + @ApiResponse({ + status: 200, + description: 'Story deleted successfully', + }) + @ApiResponse({ + status: 404, + description: 'Story not found', + }) + async removeStoryFromAnthology( + @Param('storyId', ParseIntPipe) storyId: number, + ): Promise<{ message: string }> { + await this.storyService.remove(storyId); + return { message: 'Story deleted successfully' }; + } + @Post('/library/anthology/:anthologyId/story') @HttpCode(HttpStatus.CREATED) @ApiOperation({ summary: 'Create a new story in a specific anthology' }) diff --git a/apps/backend/tsconfig.app.json b/apps/backend/tsconfig.app.json index f10e646f3..3fb0608c2 100644 --- a/apps/backend/tsconfig.app.json +++ b/apps/backend/tsconfig.app.json @@ -2,10 +2,10 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../dist/out-tsc", - "module": "esnext", "types": ["node"], "emitDecoratorMetadata": true, - "target": "es2021" + "target": "es2021", + "strictPropertyInitialization": false }, "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"], "include": ["src/**/*.ts"] diff --git a/apps/backend/tsconfig.json b/apps/backend/tsconfig.json index c1e2dd4e8..983545883 100644 --- a/apps/backend/tsconfig.json +++ b/apps/backend/tsconfig.json @@ -11,6 +11,7 @@ } ], "compilerOptions": { - "esModuleInterop": true + "esModuleInterop": true, + "baseUrl": "." } }