|
@@ -7,39 +7,77 @@ import {
|
|
|
Put,
|
|
Put,
|
|
|
Delete,
|
|
Delete,
|
|
|
} from '@nestjs/common';
|
|
} from '@nestjs/common';
|
|
|
-import { ApiTags } from '@nestjs/swagger';
|
|
|
|
|
|
|
+import { ApiResponse, ApiTags, ApiOperation, ApiParam } from '@nestjs/swagger';
|
|
|
import { CreateCompanyDto } from '../../application/dto/create-company.dto';
|
|
import { CreateCompanyDto } from '../../application/dto/create-company.dto';
|
|
|
import { UpdateCompanyDto } from '../../application/dto/update-company.dto';
|
|
import { UpdateCompanyDto } from '../../application/dto/update-company.dto';
|
|
|
import { FindAllCompaniesUseCase } from '../../application/use-cases/company/find-all-companies.use-case';
|
|
import { FindAllCompaniesUseCase } from '../../application/use-cases/company/find-all-companies.use-case';
|
|
|
|
|
+import { CompanyResponseDto } from 'src/application/dto/responses/company-response.dto';
|
|
|
|
|
|
|
|
@ApiTags('companies')
|
|
@ApiTags('companies')
|
|
|
@Controller('companies')
|
|
@Controller('companies')
|
|
|
export class CompanyController {
|
|
export class CompanyController {
|
|
|
constructor(
|
|
constructor(
|
|
|
- private readonly findAllCompaniesUseCase: FindAllCompaniesUseCase
|
|
|
|
|
|
|
+ private readonly findAllCompaniesUseCase: FindAllCompaniesUseCase,
|
|
|
) {}
|
|
) {}
|
|
|
|
|
|
|
|
@Post()
|
|
@Post()
|
|
|
|
|
+ @ApiOperation({ summary: 'Créer une nouvelle entreprise' })
|
|
|
|
|
+ @ApiResponse({
|
|
|
|
|
+ status: 201,
|
|
|
|
|
+ description: "L'entreprise a été créée avec succès",
|
|
|
|
|
+ type: CreateCompanyDto,
|
|
|
|
|
+ })
|
|
|
async create(@Body() createCompanyDto: CreateCompanyDto) {
|
|
async create(@Body() createCompanyDto: CreateCompanyDto) {
|
|
|
// Implementation
|
|
// Implementation
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Get()
|
|
@Get()
|
|
|
|
|
+ @ApiOperation({ summary: 'Récupérer toutes les entreprises' })
|
|
|
|
|
+ @ApiResponse({
|
|
|
|
|
+ status: 200,
|
|
|
|
|
+ description: 'Liste de toutes les entreprises',
|
|
|
|
|
+ type: [CompanyResponseDto],
|
|
|
|
|
+ })
|
|
|
async findAll() {
|
|
async findAll() {
|
|
|
return this.findAllCompaniesUseCase.execute();
|
|
return this.findAllCompaniesUseCase.execute();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Get(':id')
|
|
@Get(':id')
|
|
|
|
|
+ @ApiOperation({ summary: 'Récupérer une entreprise par son ID' })
|
|
|
|
|
+ @ApiParam({ name: 'id', description: "ID de l'entreprise" })
|
|
|
|
|
+ @ApiResponse({
|
|
|
|
|
+ status: 200,
|
|
|
|
|
+ description: "L'entreprise a été trouvée",
|
|
|
|
|
+ type: CompanyResponseDto,
|
|
|
|
|
+ })
|
|
|
|
|
+ @ApiResponse({ status: 404, description: 'Entreprise non trouvée' })
|
|
|
async findOne(@Param('id') id: string) {
|
|
async findOne(@Param('id') id: string) {
|
|
|
// TODO: Implement get company by id use case
|
|
// TODO: Implement get company by id use case
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Put(':id')
|
|
@Put(':id')
|
|
|
- async update(@Param('id') id: string, @Body() updateCompanyDto: any) {
|
|
|
|
|
|
|
+ @ApiOperation({ summary: 'Mettre à jour une entreprise' })
|
|
|
|
|
+ @ApiParam({ name: 'id', description: "ID de l'entreprise" })
|
|
|
|
|
+ @ApiResponse({
|
|
|
|
|
+ status: 200,
|
|
|
|
|
+ description: "L'entreprise a été mise à jour",
|
|
|
|
|
+ type: CompanyResponseDto,
|
|
|
|
|
+ })
|
|
|
|
|
+ async update(
|
|
|
|
|
+ @Param('id') id: string,
|
|
|
|
|
+ @Body() updateCompanyDto: UpdateCompanyDto,
|
|
|
|
|
+ ) {
|
|
|
// TODO: Implement update company use case
|
|
// TODO: Implement update company use case
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Delete(':id')
|
|
@Delete(':id')
|
|
|
|
|
+ @ApiOperation({ summary: 'Supprimer une entreprise' })
|
|
|
|
|
+ @ApiParam({ name: 'id', description: "ID de l'entreprise" })
|
|
|
|
|
+ @ApiResponse({
|
|
|
|
|
+ status: 200,
|
|
|
|
|
+ description: "L'entreprise a été supprimée",
|
|
|
|
|
+ type: CompanyResponseDto,
|
|
|
|
|
+ })
|
|
|
async remove(@Param('id') id: string) {
|
|
async remove(@Param('id') id: string) {
|
|
|
// TODO: Implement delete company use case
|
|
// TODO: Implement delete company use case
|
|
|
}
|
|
}
|