Skip to content

Commit

Permalink
📝 Updated nest swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Dec 18, 2023
1 parent 326133a commit 4502292
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 60 deletions.
10 changes: 5 additions & 5 deletions packages/api/src/@core/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,37 @@ export class AuthController {
this.logger.setContext(AuthController.name);
}

@ApiOperation({ operationId: 'signUp' })
@ApiOperation({ operationId: 'signUp', summary: 'Register' })
@ApiBody({ type: CreateUserDto })
@ApiResponse({ status: 201 })
@Post('register')
async registerUser(@Body() user: CreateUserDto) {
return this.authService.register(user);
}

@ApiOperation({ operationId: 'signIn' })
@ApiOperation({ operationId: 'signIn', summary: 'Log In' })
@ApiBody({ type: LoginDto })
@ApiResponse({ status: 201 })
@Post('login')
async login(@Body() user: LoginDto) {
return this.authService.login(user);
}

@ApiOperation({ operationId: 'getUsers' })
@ApiOperation({ operationId: 'getUsers', summary: 'Get users' })
@ApiResponse({ status: 200 })
@Get('users')
async users() {
return this.authService.getUsers();
}

@ApiOperation({ operationId: 'getApiKeys' })
@ApiOperation({ operationId: 'getApiKeys', summary: 'Retrieve API Keys' })
@ApiResponse({ status: 200 })
@Get('api-keys')
async apiKeys() {
return this.authService.getApiKeys();
}

@ApiOperation({ operationId: 'generateApiKey' })
@ApiOperation({ operationId: 'generateApiKey', summary: 'Create API Key' })
@ApiBody({ type: ApiKeyDto })
@ApiResponse({ status: 201 })
@UseGuards(JwtAuthGuard)
Expand Down
10 changes: 8 additions & 2 deletions packages/api/src/@core/connections/connections.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export class ConnectionsController {
this.logger.setContext(ConnectionsController.name);
}

@ApiOperation({ operationId: 'handleOAuthCallback' })
@ApiOperation({
operationId: 'handleOAuthCallback',
summary: 'Capture oAuth Callback',
})
@ApiQuery({ name: 'state', required: true, type: String })
@ApiQuery({ name: 'code', required: true, type: String })
@ApiQuery({ name: 'location', required: true, type: String })
Expand Down Expand Up @@ -74,7 +77,10 @@ export class ConnectionsController {
}
}

@ApiOperation({ operationId: 'getConnections' })
@ApiOperation({
operationId: 'getConnections',
summary: 'Retrieve Connections',
})
@ApiResponse({ status: 200 })
@Get()
async getConnections() {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/@core/events/events.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class EventsController {
this.logger.setContext(EventsController.name);
}

@ApiOperation({ operationId: 'getEvents' })
@ApiOperation({ operationId: 'getEvents', summary: 'Retrieve Events' })
@ApiResponse({ status: 200 })
@Get()
async getEvents() {
Expand Down
27 changes: 21 additions & 6 deletions packages/api/src/@core/field-mapping/field-mapping.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,40 @@ export class FieldMappingController {
this.logger.setContext(FieldMappingController.name);
}

@ApiOperation({ operationId: 'getFieldMappingsEntities' })
@ApiOperation({
operationId: 'getFieldMappingsEntities',
summary: 'Retrieve field mapping entities',
})
@ApiResponse({ status: 200 })
@Get('entities')
getEntities() {
return this.fieldMappingService.getEntities();
}

@ApiOperation({ operationId: 'getFieldMappings' })
@ApiOperation({
operationId: 'getFieldMappings',
summary: 'Retrieve field mappings',
})
@ApiResponse({ status: 200 })
@Get('attribute')
getAttributes() {
return this.fieldMappingService.getAttributes();
}

@ApiOperation({ operationId: 'getFieldMappingValues' })
@ApiOperation({
operationId: 'getFieldMappingValues',
summary: 'Retrieve field mappings values',
})
@ApiResponse({ status: 200 })
@Get('value')
getValues() {
return this.fieldMappingService.getValues();
}

@ApiOperation({ operationId: 'defineTargetField' })
@ApiOperation({
operationId: 'defineTargetField',
summary: 'Define target Field',
})
@ApiBody({ type: DefineTargetFieldDto })
@ApiResponse({ status: 201 })
//define target field on our unified model
Expand All @@ -47,15 +59,18 @@ export class FieldMappingController {
return this.fieldMappingService.defineTargetField(defineTargetFieldDto);
}

@ApiOperation({ operationId: 'mapField' })
@ApiOperation({ operationId: 'mapField', summary: 'Map Custom Field' })
@ApiBody({ type: MapFieldToProviderDto })
@ApiResponse({ status: 201 })
@Post('map')
mapFieldToProvider(@Body() mapFieldToProviderDto: MapFieldToProviderDto) {
return this.fieldMappingService.mapFieldToProvider(mapFieldToProviderDto);
}

@ApiOperation({ operationId: 'getCustomProviderProperties' })
@ApiOperation({
operationId: 'getCustomProviderProperties',
summary: 'Retrieve Custom Properties',
})
@ApiResponse({ status: 200 })
@Get('properties')
getCustomProperties(
Expand Down
12 changes: 9 additions & 3 deletions packages/api/src/@core/linked-users/linked-users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,28 @@ export class LinkedUsersController {
this.logger.setContext(LinkedUsersController.name);
}

@ApiOperation({ operationId: 'addLinkedUser' })
@ApiOperation({ operationId: 'addLinkedUser', summary: 'Add Linked User' })
@ApiBody({ type: CreateLinkedUserDto })
@ApiResponse({ status: 201 })
@Post('create')
addLinkedUser(@Body() linkedUserCreateDto: CreateLinkedUserDto) {
return this.linkedUsersService.addLinkedUser(linkedUserCreateDto);
}

@ApiOperation({ operationId: 'getLinkedUsers' })
@ApiOperation({
operationId: 'getLinkedUsers',
summary: 'Retrieve Linked Users',
})
@ApiResponse({ status: 200 })
@Get()
getLinkedUsers() {
return this.linkedUsersService.getLinkedUsers();
}

@ApiOperation({ operationId: 'getLinkedUser' })
@ApiOperation({
operationId: 'getLinkedUser',
summary: 'Retrieve a Linked User',
})
@ApiQuery({ name: 'id', required: true, type: String })
@ApiResponse({ status: 200 })
@Get('single')
Expand Down
15 changes: 12 additions & 3 deletions packages/api/src/@core/magic-link/magic-link.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,31 @@ export class MagicLinkController {
this.logger.setContext(MagicLinkController.name);
}

@ApiOperation({ operationId: 'createMagicLink' })
@ApiOperation({
operationId: 'createMagicLink',
summary: 'Create a Magic Link',
})
@ApiBody({ type: CreateMagicLinkDto })
@ApiResponse({ status: 201 })
@Post('create')
createLink(@Body() data: CreateMagicLinkDto) {
return this.magicLinkService.createUniqueLink(data);
}

@ApiOperation({ operationId: 'getMagicLinks' })
@ApiOperation({
operationId: 'getMagicLinks',
summary: 'Retrieve Magic Links',
})
@ApiResponse({ status: 200 })
@Get()
getMagicLinks() {
return this.magicLinkService.getMagicLinks();
}

@ApiOperation({ operationId: 'getMagicLink' })
@ApiOperation({
operationId: 'getMagicLink',
summary: 'Retrieve a Magic Link',
})
@ApiQuery({ name: 'id', required: true, type: String })
@ApiResponse({ status: 200 })
@Get('single')
Expand Down
10 changes: 8 additions & 2 deletions packages/api/src/@core/organisations/organisations.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ export class OrganisationsController {
this.logger.setContext(OrganisationsController.name);
}

@ApiOperation({ operationId: 'getOrganisations' })
@ApiOperation({
operationId: 'getOrganisations',
summary: 'Retrieve Organisations',
})
@Get()
getOragnisations() {
return this.organizationsService.getOrganisations();
}

@ApiOperation({ operationId: 'createOrganisation' })
@ApiOperation({
operationId: 'createOrganisation',
summary: 'Create an Organisation',
})
@ApiBody({ type: CreateOrganizationDto })
@ApiResponse({ status: 201 })
@Post('create')
Expand Down
5 changes: 4 additions & 1 deletion packages/api/src/@core/passthrough/passthrough.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export class PassthroughController {
this.loggerSeervice.setContext(PassthroughController.name);
}

@ApiOperation({ operationId: 'passthroughRequest' })
@ApiOperation({
operationId: 'passthroughRequest',
summary: 'Make a passthrough request',
})
@ApiQuery({ name: 'integrationId', required: true, type: String })
@ApiQuery({ name: 'linkedUserId', required: true, type: String })
@ApiBody({ type: PassThroughRequestDto })
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/@core/projects/projects.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ export class ProjectsController {
this.logger.setContext(ProjectsController.name);
}

@ApiOperation({ operationId: 'getProjects' })
@ApiOperation({ operationId: 'getProjects', summary: 'Retrieve projects' })
@ApiResponse({ status: 200 })
@Get()
getProjects() {
return this.projectsService.getProjects();
}

@ApiOperation({ operationId: 'createProject' })
@ApiOperation({ operationId: 'createProject', summary: 'Create a project' })
@ApiBody({ type: CreateProjectDto })
@ApiResponse({ status: 201 })
@Post('create')
Expand Down
15 changes: 12 additions & 3 deletions packages/api/src/@core/webhook/webhook.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@ export class WebhookController {
this.loggerSeervice.setContext(WebhookController.name);
}

@ApiOperation({ operationId: 'getWebhooksMetadata' })
@ApiOperation({
operationId: 'getWebhooksMetadata',
summary: 'Retrieve webhooks metadata ',
})
@ApiResponse({ status: 200 })
@Get()
getWebhooks() {
return this.webhookService.getWebhookEndpoints();
}

@ApiOperation({ operationId: 'updateWebhookStatus' })
@ApiOperation({
operationId: 'updateWebhookStatus',
summary: 'Update webhook status',
})
@Put(':id')
async updateWebhookStatus(
@Param('id') id: string,
Expand All @@ -30,7 +36,10 @@ export class WebhookController {
return this.webhookService.updateStatusWebhookEndpoint(id, active);
}

@ApiOperation({ operationId: 'createWebhookMetadata' })
@ApiOperation({
operationId: 'createWebhookMetadata',
summary: 'Add webhook metadata',
})
@ApiBody({ type: WebhookDto })
@ApiResponse({ status: 201 })
@Post()
Expand Down
Loading

0 comments on commit 4502292

Please sign in to comment.