Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: REST Compliance #597

Merged
merged 5 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/webapp/src/hooks/create/useCreateApiKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IApiKeyDto {
// Adjusted useCreateApiKey hook to include a promise-returning function
const useCreateApiKey = () => {
const addApiKey = async (data: IApiKeyDto) => {
const response = await fetch(`${config.API_URL}/auth/generate-apikey`, {
const response = await fetch(`${config.API_URL}/auth/api_keys`, {
method: 'POST',
body: JSON.stringify(data),
headers: {
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/hooks/create/useCreateLinkedUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface ILinkedUserDto {
}
const useCreateLinkedUser = () => {
const add = async (linkedUserData: ILinkedUserDto) => {
const response = await fetch(`${config.API_URL}/linked-users/internal`, {
const response = await fetch(`${config.API_URL}/linked_users/internal`, {
method: 'POST',
body: JSON.stringify(linkedUserData),
headers: {
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/hooks/create/useCreateMagicLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ILinkDto {

const useCreateMagicLink = () => {
const add = async (data: ILinkDto) => {
const response = await fetch(`${config.API_URL}/magic-links`, {
const response = await fetch(`${config.API_URL}/magic_links`, {
method: 'POST',
body: JSON.stringify(data),
headers: {
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/hooks/create/useRefreshAccessToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface IRefreshOutputDto {

const useRefreshAccessToken = () => {
const refreshAccessToken = async (projectId: string) => {
const response = await fetch(`${config.API_URL}/auth/refresh-token`, {
const response = await fetch(`${config.API_URL}/auth/refresh_tokens`, {
method: 'POST',
body: JSON.stringify({
projectId: projectId
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/hooks/get/useApiKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const useApiKeys = () => {
return useQuery({
queryKey: ['api-keys'],
queryFn: async (): Promise<ApiKey[]> => {
const response = await fetch(`${config.API_URL}/auth/api-keys`,
const response = await fetch(`${config.API_URL}/auth/api_keys`,
{
method: 'GET',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/hooks/get/useFieldMappings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const useFieldMappings = () => {
return useQuery({
queryKey: ['mappings'],
queryFn: async (): Promise<Attribute[]> => {
const response = await fetch(`${config.API_URL}/field-mappings/attribute`,
const response = await fetch(`${config.API_URL}/field_mappings/attributes`,
{
method: 'GET',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/hooks/get/useLinkedUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const useLinkedUsers = () => {
return useQuery({
queryKey: ['linked-users'],
queryFn: async (): Promise<LinkedUser[]> => {
const response = await fetch(`${config.API_URL}/linked-users/internal`,
const response = await fetch(`${config.API_URL}/linked_users/internal`,
{
method: 'GET',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/hooks/get/useProviderProperties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const useProviderProperties = (linkedUserId: string, providerId: string, vertica
return useQuery({
queryKey: ['providerProperties', linkedUserId, providerId, vertical],
queryFn: async () => {
const response = await fetch(`${config.API_URL}/field-mappings/properties?linkedUserId=${linkedUserId}&providerId=${providerId}&vertical=${vertical}`,
const response = await fetch(`${config.API_URL}/field_mappings/properties?linkedUserId=${linkedUserId}&providerId=${providerId}&vertical=${vertical}`,
{
method: 'GET',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/hooks/get/useWebhooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const useWebhooks = () => {
queryKey: ['webhooks'],
queryFn: async (): Promise<Webhook[]> => {
console.log("Webhook mutation called")
const response = await fetch(`${config.API_URL}/webhook/internal`,
const response = await fetch(`${config.API_URL}/webhooks/internal`,
{
method: 'GET',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/auth/create-api-key.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: post /auth/generate-apikey
openapi: post /auth/api_keys
---
2 changes: 1 addition & 1 deletion docs/api-reference/auth/retrieve-api-keys.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: get /auth/api-keys
openapi: get /auth/api_keys
---
2 changes: 1 addition & 1 deletion docs/api-reference/field-mapping/define-target-field.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: post /field-mapping/define
openapi: post /field_mappings/definitions
---
2 changes: 1 addition & 1 deletion docs/api-reference/field-mapping/map-custom-field.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: post /field-mapping/map
openapi: post /field_mappings/mappings
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: get /field-mapping/properties
openapi: get /field_mappings/properties
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: get /field-mapping/entities
openapi: get /field_mappings/entities
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: get /field-mapping/value
openapi: get /field_mappings/values
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: get /field-mapping/attribute
openapi: get /field_mappings/attributes
---
2 changes: 1 addition & 1 deletion docs/api-reference/magic-link/retrieve-magic-links.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: get /magic-link
openapi: get /magic_links
---
2 changes: 1 addition & 1 deletion docs/api-reference/projects/create-a-project.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: post /projects/create
openapi: post /projects
---
6 changes: 3 additions & 3 deletions docs/core-concepts/custom-fields.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The following example creates a custom field mapping in two steps (**define and

```shell Create custom field
curl --request POST \
--url https://api.panora.dev/field-mappings \
--url https://api.panora.dev/field_mappings \
--header 'Authorization: Bearer <MY_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
Expand All @@ -76,7 +76,7 @@ The following example creates a custom field mapping in two steps (**define and
<CodeGroup>
```shell Define custom field
curl --request POST \
--url https://api.panora.dev/field-mappings/define \
--url https://api.panora.dev/field_mappings/definitions \
--header 'Authorization: Bearer <MY_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
Expand All @@ -89,7 +89,7 @@ The following example creates a custom field mapping in two steps (**define and

```shell Map custom field
curl --request POST \
--url https://api.panora.dev/field-mappings/map \
--url https://api.panora.dev/field_mappings/mappings \
--header 'Authorization: Bearer <MY_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -41,7 +41,7 @@ export class WebhookController {

@ApiOperation({
operationId: 'listWebhooks',
summary: 'List webhooks ',
summary: 'List webhooks',
})
@ApiGetArrayCustomResponse(WebhookResponse)
@UseGuards(ApiKeyAuthGuard)
Expand Down
12 changes: 6 additions & 6 deletions packages/api/src/@core/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class AuthController {

@ApiOperation({ operationId: 'requestPasswordReset', summary: 'Request Password Reset' })
@ApiBody({ type: RequestPasswordResetDto })
@Post('request-password-reset')
@Post('password_reset_request')
async requestPasswordReset(@Body() requestPasswordResetDto: RequestPasswordResetDto) {
return this.authService.requestPasswordReset(requestPasswordResetDto);
}
Expand All @@ -71,7 +71,7 @@ export class AuthController {
@ApiOperation({ operationId: 'resetPassword', summary: 'Reset Password' })
@ApiBody({ type: ResetPasswordDto })
@ApiResponse({ status: 200, description: 'Password reset successfully' })
@Post('reset-password')
@Post('reset_password')
async resetPassword(@Body() resetPasswordDto: ResetPasswordDto) {
return this.authService.resetPassword(resetPasswordDto);
}
Expand All @@ -86,15 +86,15 @@ export class AuthController {
@ApiOperation({ operationId: 'getApiKeys', summary: 'Retrieve API Keys' })
@ApiResponse({ status: 200 })
@UseGuards(JwtAuthGuard)
@Get('api-keys')
@Get('api_keys')
async getApiKeys(@Request() req: any) {
const { id_project } = req.user;
return this.authService.getApiKeys(id_project);
}

@ApiOperation({ operationId: 'deleteApiKey', summary: 'Delete API Keys' })
@ApiResponse({ status: 201 })
@Delete('api-keys/:id')
@Delete('api_keys/:id')
@UseGuards(JwtAuthGuard)
async deleteApiKey(@Param('id') apiKeyId: string) {
return await this.authService.deleteApiKey(apiKeyId);
Expand All @@ -104,7 +104,7 @@ export class AuthController {
@ApiBody({ type: ApiKeyDto })
@ApiResponse({ status: 201 })
@UseGuards(JwtAuthGuard)
@Post('generate-apikey')
@Post()
async generateApiKey(@Body() data: ApiKeyDto): Promise<{ api_key: string }> {
return this.authService.generateApiKeyForUser(
data.userId,
Expand All @@ -120,7 +120,7 @@ export class AuthController {
@ApiBody({ type: RefreshDto })
@ApiResponse({ status: 201 })
@UseGuards(JwtAuthGuard)
@Post('refresh-token')
@Post('refresh_token')
refreshAccessToken(@Request() req: any, @Body() body: RefreshDto) {
const { projectId } = body;
const { id_user, email, first_name, last_name } = req.user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import { UpdateCSDto } from './dto/update-cs.dto';
import { ConnectionStrategyCredentials } from './dto/get-connection-cs-credentials.dto';
import { JwtAuthGuard } from '@@core/auth/guards/jwt-auth.guard';

@ApiTags('connections-strategies')
@ApiTags('connection_strategies')
@ApiExcludeController()
@Controller('connections-strategies')
@Controller('connection_strategies')
export class ConnectionsStrategiesController {
constructor(
private logger: LoggerService,
Expand Down
10 changes: 5 additions & 5 deletions packages/api/src/@core/field-mapping/field-mapping.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -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 })
Expand All @@ -91,7 +91,7 @@ export class FieldMappingController {
}

@ApiOperation({
operationId: 'create',
operationId: 'createCustomField',
summary: 'Create Custom Field',
})
@ApiBody({ type: CustomFieldCreateDto })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -68,7 +68,7 @@ export class LinkedUsersController {

@ApiOperation({
operationId: 'listLinkedUsers',
summary: 'Retrieve Linked Users',
summary: 'List Linked Users',
})
@ApiResponse({ status: 200 })
@UseGuards(ApiKeyAuthGuard)
Expand All @@ -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 })
Expand Down
10 changes: 5 additions & 5 deletions packages/api/src/@core/magic-link/magic-link.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 })
Expand All @@ -36,7 +36,7 @@ export class MagicLinkController {

@ApiOperation({
operationId: 'getMagicLinks',
summary: 'Retrieve Magic Links',
summary: 'List Magic Links',
})
@ApiResponse({ status: 200 })
@Get()
Expand All @@ -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 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class OrganisationsController {
})
@Get()
getOragnisations() {
return; //this.organizationsService.getOrganisations();
return;
}

@ApiOperation({
Expand All @@ -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;
}
}
Loading
Loading