-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(swagger): Enhance API documentation with detailed @ApiBody decor…
…ators - Implemented comprehensive @ApiBody decorators for required endpoints - Added explicit schema and example values to improve Swagger documentation - Enhanced API documentation for better developer understanding and testing
- Loading branch information
1 parent
c1a270d
commit f778a10
Showing
5 changed files
with
332 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,104 @@ | |
|
||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; | ||
import { CompanyService } from './company.service'; | ||
import { ApiBody } from '@nestjs/swagger'; | ||
|
||
@Controller('company') | ||
export class CompanyController { | ||
constructor(private readonly companyService: CompanyService) {} | ||
|
||
@Post() | ||
@ApiBody({ | ||
description: 'Details for creating a company', | ||
required: true, | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
company_name: { | ||
type: 'string', | ||
example: 'Example Company Ltd.' | ||
}, | ||
registration_number: { | ||
type: 'string', | ||
example: 'REG123456' | ||
}, | ||
company_ifric_id: { | ||
type: 'string', | ||
example: 'IFRIC54321' | ||
}, | ||
address_1: { | ||
type: 'string', | ||
example: '123 Main Street' | ||
}, | ||
city: { | ||
type: 'string', | ||
example: 'New York' | ||
}, | ||
country: { | ||
type: 'string', | ||
example: 'USA' | ||
}, | ||
zip: { | ||
type: 'string', | ||
example: '10001' | ||
}, | ||
admin_name: { | ||
type: 'string', | ||
example: 'John Admin' | ||
}, | ||
position: { | ||
type: 'string', | ||
example: 'CEO' | ||
}, | ||
email: { | ||
type: 'string', | ||
example: '[email protected]' | ||
}, | ||
password: { | ||
type: 'string', | ||
example: 'strongpassword123' | ||
}, | ||
company_size: { | ||
type: 'string', | ||
example: '100-500' | ||
}, | ||
company_category_id: { | ||
type: 'number', | ||
example: 1 | ||
}, | ||
company_category: { | ||
type: 'string', | ||
example: 'IT Services' | ||
}, | ||
meta_data: { | ||
type: 'object', | ||
additionalProperties: true, | ||
example: { industry: 'Technology', revenue: '1M+' } | ||
}, | ||
company_domain: { | ||
type: 'string', | ||
example: 'example.com' | ||
} | ||
}, | ||
required: [ | ||
'company_name', | ||
'registration_number', | ||
'company_ifric_id', | ||
'address_1', | ||
'city', | ||
'country', | ||
'zip', | ||
'admin_name', | ||
'position', | ||
'email', | ||
'password', | ||
'company_size', | ||
'company_category', | ||
'meta_data', | ||
'company_domain', | ||
], | ||
}, | ||
}) | ||
create(@Body() data: any) { | ||
return this.companyService.create(data); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.