From 2202f74c2afcfbdf3bed2e1663baad19d6cf5626 Mon Sep 17 00:00:00 2001 From: Rachid Flih Date: Thu, 1 Aug 2024 19:27:28 +0100 Subject: [PATCH] feat: REST Compliances --- .../panora-webhooks/webhook.controller.ts | 6 ++-- .../field-mapping/field-mapping.controller.ts | 10 +++--- .../linked-users/linked-users.controller.ts | 8 ++--- .../@core/magic-link/magic-link.controller.ts | 10 +++--- .../organisations/organisations.controller.ts | 6 ++-- packages/api/swagger/swagger-spec.yaml | 31 +++++++++---------- 6 files changed, 34 insertions(+), 37 deletions(-) diff --git a/packages/api/src/@core/@core-services/webhooks/panora-webhooks/webhook.controller.ts b/packages/api/src/@core/@core-services/webhooks/panora-webhooks/webhook.controller.ts index 553b18909..c7cae957f 100644 --- a/packages/api/src/@core/@core-services/webhooks/panora-webhooks/webhook.controller.ts +++ b/packages/api/src/@core/@core-services/webhooks/panora-webhooks/webhook.controller.ts @@ -29,8 +29,8 @@ import { WebhookResponse, } from './dto/webhook.dto'; import { WebhookService } from './webhook.service'; -@ApiTags('webhook') -@Controller('webhook') +@ApiTags('webhooks') +@Controller('webhooks') export class WebhookController { constructor( private webhookService: WebhookService, @@ -41,7 +41,7 @@ export class WebhookController { @ApiOperation({ operationId: 'listWebhooks', - summary: 'List webhooks ', + summary: 'List webhooks', }) @ApiGetArrayCustomResponse(WebhookResponse) @UseGuards(ApiKeyAuthGuard) diff --git a/packages/api/src/@core/field-mapping/field-mapping.controller.ts b/packages/api/src/@core/field-mapping/field-mapping.controller.ts index 778c78fa2..4563728b5 100644 --- a/packages/api/src/@core/field-mapping/field-mapping.controller.ts +++ b/packages/api/src/@core/field-mapping/field-mapping.controller.ts @@ -24,7 +24,7 @@ import { import { JwtAuthGuard } from '@@core/auth/guards/jwt-auth.guard'; @ApiTags('fieldMappings') -@Controller('field-mappings') +@Controller('field_mappings') export class FieldMappingController { constructor( private readonly fieldMappingService: FieldMappingService, @@ -51,7 +51,7 @@ export class FieldMappingController { }) @ApiResponse({ status: 200 }) @ApiExcludeEndpoint() - @Get('attribute') + @Get('attributes') @UseGuards(JwtAuthGuard) getAttributes(@Request() req: any) { const { id_project } = req.user; @@ -64,14 +64,14 @@ export class FieldMappingController { }) @ApiResponse({ status: 200 }) @ApiExcludeEndpoint() - @Get('value') + @Get('values') @UseGuards(JwtAuthGuard) getValues() { return this.fieldMappingService.getValues(); } @ApiOperation({ - operationId: 'define', + operationId: 'definitions', summary: 'Define target Field', }) @ApiBody({ type: DefineTargetFieldDto }) @@ -91,7 +91,7 @@ export class FieldMappingController { } @ApiOperation({ - operationId: 'create', + operationId: 'createCustomField', summary: 'Create Custom Field', }) @ApiBody({ type: CustomFieldCreateDto }) diff --git a/packages/api/src/@core/linked-users/linked-users.controller.ts b/packages/api/src/@core/linked-users/linked-users.controller.ts index 3206de2f7..62434e48b 100644 --- a/packages/api/src/@core/linked-users/linked-users.controller.ts +++ b/packages/api/src/@core/linked-users/linked-users.controller.ts @@ -25,7 +25,7 @@ import { JwtAuthGuard } from '@@core/auth/guards/jwt-auth.guard'; import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('linkedUsers') -@Controller('linked-users') +@Controller('linked_users') export class LinkedUsersController { constructor( private readonly linkedUsersService: LinkedUsersService, @@ -34,7 +34,7 @@ export class LinkedUsersController { this.logger.setContext(LinkedUsersController.name); } - @ApiOperation({ operationId: 'createLinkedUser', summary: 'Add Linked User' }) + @ApiOperation({ operationId: 'createLinkedUser', summary: 'Create Linked Users' }) @ApiBody({ type: CreateLinkedUserDto }) @ApiResponse({ status: 201 }) @UseGuards(ApiKeyAuthGuard) @@ -68,7 +68,7 @@ export class LinkedUsersController { @ApiOperation({ operationId: 'listLinkedUsers', - summary: 'Retrieve Linked Users', + summary: 'List Linked Users', }) @ApiResponse({ status: 200 }) @UseGuards(ApiKeyAuthGuard) @@ -80,7 +80,7 @@ export class LinkedUsersController { @ApiOperation({ operationId: 'retrieveLinkedUser', - summary: 'Retrieve a Linked User', + summary: 'Retrieve Linked Users', }) @ApiQuery({ name: 'id', required: true, type: String }) @ApiResponse({ status: 200 }) diff --git a/packages/api/src/@core/magic-link/magic-link.controller.ts b/packages/api/src/@core/magic-link/magic-link.controller.ts index 10684291e..6c552db76 100644 --- a/packages/api/src/@core/magic-link/magic-link.controller.ts +++ b/packages/api/src/@core/magic-link/magic-link.controller.ts @@ -11,9 +11,9 @@ import { ApiTags, } from '@nestjs/swagger'; import { JwtAuthGuard } from '@@core/auth/guards/jwt-auth.guard'; -@ApiTags('magic-links') +@ApiTags('magic_links') @ApiExcludeController() -@Controller('magic-links') +@Controller('magic_links') export class MagicLinkController { constructor( private readonly magicLinkService: MagicLinkService, @@ -24,7 +24,7 @@ export class MagicLinkController { @ApiOperation({ operationId: 'createMagicLink', - summary: 'Create a Magic Link', + summary: 'Create Magic Links', }) @ApiBody({ type: CreateMagicLinkDto }) @ApiResponse({ status: 201 }) @@ -36,7 +36,7 @@ export class MagicLinkController { @ApiOperation({ operationId: 'getMagicLinks', - summary: 'Retrieve Magic Links', + summary: 'List Magic Links', }) @ApiResponse({ status: 200 }) @Get() @@ -46,7 +46,7 @@ export class MagicLinkController { @ApiOperation({ operationId: 'getMagicLink', - summary: 'Retrieve a Magic Link', + summary: 'Retrieve Magic Links', }) @ApiQuery({ name: 'id', required: true, type: String }) @ApiResponse({ status: 200 }) diff --git a/packages/api/src/@core/organisations/organisations.controller.ts b/packages/api/src/@core/organisations/organisations.controller.ts index 8bd349929..6c3f6a692 100644 --- a/packages/api/src/@core/organisations/organisations.controller.ts +++ b/packages/api/src/@core/organisations/organisations.controller.ts @@ -27,7 +27,7 @@ export class OrganisationsController { }) @Get() getOragnisations() { - return; //this.organizationsService.getOrganisations(); + return; } @ApiOperation({ @@ -36,8 +36,8 @@ export class OrganisationsController { }) @ApiBody({ type: CreateOrganizationDto }) @ApiResponse({ status: 201 }) - @Post('create') + @Post() createOrg(@Body() orgCreateDto: CreateOrganizationDto) { - return; //this.organizationsService.createOrganization(orgCreateDto); + return; } } diff --git a/packages/api/swagger/swagger-spec.yaml b/packages/api/swagger/swagger-spec.yaml index c62e16d0d..ba7375cff 100644 --- a/packages/api/swagger/swagger-spec.yaml +++ b/packages/api/swagger/swagger-spec.yaml @@ -16,10 +16,10 @@ paths: responses: '200': description: '' - /webhook: + /webhooks: get: operationId: listWebhooks - summary: 'List webhooks ' + summary: List webhooks parameters: [] responses: '200': @@ -31,8 +31,7 @@ paths: items: $ref: '#/components/schemas/WebhookResponse' tags: &ref_0 - - webhook - x-speakeasy-group: webhook + - webhooks post: operationId: createWebhook summary: Add webhook metadata @@ -51,8 +50,7 @@ paths: schema: $ref: '#/components/schemas/WebhookResponse' tags: *ref_0 - x-speakeasy-group: webhook - /webhook/{id}: + /webhooks/{id}: delete: operationId: delete summary: Delete Webhook @@ -70,7 +68,7 @@ paths: schema: $ref: '#/components/schemas/WebhookResponse' tags: *ref_0 - x-speakeasy-group: webhook + x-speakeasy-group: webhooks.{id} put: operationId: updateStatus summary: Update webhook status @@ -88,8 +86,8 @@ paths: schema: $ref: '#/components/schemas/WebhookResponse' tags: *ref_0 - x-speakeasy-group: webhook - /webhook/verifyEvent: + x-speakeasy-group: webhooks.{id} + /webhooks/verifyEvent: post: operationId: verifyEvent summary: Verify payload signature of the webhook @@ -108,7 +106,7 @@ paths: schema: $ref: '#/components/schemas/EventPayload' tags: *ref_0 - x-speakeasy-group: webhook + x-speakeasy-group: webhooks.verifyevent /ticketing/tickets: get: operationId: listTicketingTicket @@ -1796,7 +1794,7 @@ paths: description: '' tags: *ref_34 x-speakeasy-group: linkedUsers - /field-mappings/define: + /field_mappings/define: post: operationId: define summary: Define target Field @@ -1812,10 +1810,10 @@ paths: description: '' tags: &ref_35 - fieldMappings - x-speakeasy-group: fieldMappings - /field-mappings: + x-speakeasy-group: field_mappings.define + /field_mappings: post: - operationId: create + operationId: createCustomField summary: Create Custom Field parameters: [] requestBody: @@ -1828,8 +1826,7 @@ paths: '201': description: '' tags: *ref_35 - x-speakeasy-group: fieldMappings - /field-mappings/map: + /field_mappings/map: post: operationId: map summary: Map Custom Field @@ -1844,7 +1841,7 @@ paths: '201': description: '' tags: *ref_35 - x-speakeasy-group: fieldMappings + x-speakeasy-group: field_mappings.map /passthrough: post: operationId: request