feat(nestjs): migrate to NestJS

This commit is contained in:
Ahmed Bouhuolia
2025-04-07 11:51:24 +02:00
parent f068218a16
commit 55fcc908ef
3779 changed files with 631 additions and 195332 deletions

View File

@@ -0,0 +1,101 @@
import {
Body,
Controller,
Delete,
Get,
Param,
Post,
Put,
} from '@nestjs/common';
import { ManualJournalsApplication } from './ManualJournalsApplication.service';
import { ApiOperation, ApiParam, ApiResponse, ApiTags } from '@nestjs/swagger';
import {
CreateManualJournalDto,
EditManualJournalDto,
} from './dtos/ManualJournal.dto';
@Controller('manual-journals')
@ApiTags('manual-journals')
export class ManualJournalsController {
constructor(private manualJournalsApplication: ManualJournalsApplication) {}
@Post()
@ApiOperation({ summary: 'Create a new manual journal.' })
public createManualJournal(@Body() manualJournalDTO: CreateManualJournalDto) {
return this.manualJournalsApplication.createManualJournal(manualJournalDTO);
}
@Put(':id')
@ApiOperation({ summary: 'Edit the given manual journal.' })
@ApiResponse({
status: 200,
description: 'The manual journal has been successfully edited.',
})
@ApiResponse({ status: 404, description: 'The manual journal not found.' })
@ApiParam({
name: 'id',
required: true,
type: Number,
description: 'The manual journal id',
})
public editManualJournal(
@Param('id') manualJournalId: number,
@Body() manualJournalDTO: EditManualJournalDto,
) {
return this.manualJournalsApplication.editManualJournal(
manualJournalId,
manualJournalDTO,
);
}
@Delete(':id')
@ApiOperation({ summary: 'Delete the given manual journal.' })
@ApiResponse({
status: 200,
description: 'The manual journal has been successfully deleted.',
})
@ApiResponse({ status: 404, description: 'The manual journal not found.' })
@ApiParam({
name: 'id',
required: true,
type: Number,
description: 'The manual journal id',
})
public deleteManualJournal(@Param('id') manualJournalId: number) {
return this.manualJournalsApplication.deleteManualJournal(manualJournalId);
}
@Put(':id/publish')
@ApiOperation({ summary: 'Publish the given manual journal.' })
@ApiResponse({
status: 200,
description: 'The manual journal has been successfully published.',
})
@ApiResponse({ status: 404, description: 'The manual journal not found.' })
@ApiParam({
name: 'id',
required: true,
type: Number,
description: 'The manual journal id',
})
public publishManualJournal(@Param('id') manualJournalId: number) {
return this.manualJournalsApplication.publishManualJournal(manualJournalId);
}
@Get(':id')
@ApiOperation({ summary: 'Retrieves the manual journal details.' })
@ApiResponse({
status: 200,
description: 'The manual journal details have been successfully retrieved.',
})
@ApiResponse({ status: 404, description: 'The manual journal not found.' })
@ApiParam({
name: 'id',
required: true,
type: Number,
description: 'The manual journal id',
})
public getManualJournal(@Param('id') manualJournalId: number) {
return this.manualJournalsApplication.getManualJournal(manualJournalId);
}
}