-
Notifications
You must be signed in to change notification settings - Fork 195
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: fix jira oauth #495
feat: fix jira oauth #495
Conversation
Qovery can create a Preview Environment for this PR.
This comment has been generated from Qovery AI 🤖.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Added environment variables for Close CRM integration in
.env.example
- Commented out ngrok service in
docker-compose.dev.yml
- Added new models and fields in
schema.prisma
for Close CRM and file storage - Updated
init.sql
andseed.sql
to support Close CRM integration - Enhanced error handling and logging in
connections.controller.ts
andjira.service.ts
- Added
CloseConnectionService
and related mappers and types for CRM modules
@@ -11,7 +11,7 @@ export class EncryptionService { | |||
this.secretKey = this.env.getCryptoKey(); | |||
} | |||
|
|||
encrypt(data: string): string { | |||
encrypt(data: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider explicitly specifying the return type for better type safety.
@@ -76,18 +76,16 @@ export function handleServiceError( | |||
} else if (error instanceof Prisma.PrismaClientKnownRequestError) { | |||
// Handle Prisma errors | |||
logger.error('Error with Prisma request:', errorMessage); | |||
throw new Error(errorMessage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throwing a generic Error for Prisma errors may obscure specific Prisma error details. Consider preserving the original error type or message for better debugging.
} else { | ||
logger.error('An unknown error occurred...', errorMessage); | ||
throw new Error(errorMessage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throwing a generic Error for unknown errors may obscure the root cause. Ensure that sufficient logging is in place to capture the original error details.
const connection = await this.prisma.connections.findFirst({ | ||
where: { | ||
id_linked_user: linkedUserId, | ||
provider_slug: 'close', | ||
vertical: 'crm', | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if connection
is null before accessing its properties to avoid potential runtime errors.
Authorization: `Bearer ${this.cryptoService.decrypt( | ||
connection.access_token, | ||
)}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure connection.access_token
is not null or undefined before decryption.
), | ||
}; | ||
|
||
result.lead_id = source?.field_mappings?.['company_id']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a null check for 'source.field_mappings' before accessing 'company_id'.
remote_id: string; | ||
}[], | ||
): Promise<UnifiedContactOutput | UnifiedContactOutput[]> { | ||
if (!Array.isArray(source)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling for cases where 'source' is neither an array nor a valid 'CloseContactOutput' object.
}, | ||
}); | ||
const resp = await axios.post( | ||
`${connection.account_url}/opportunity`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if connection
is null before using it to avoid potential runtime errors.
}, | ||
}); | ||
|
||
const baseURL = `${connection.account_url}/opportunity/`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if connection
is null before using it to avoid potential runtime errors.
source.company_id, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential bug: Should use source.stage_id
instead of source.company_id
.
@@ -85,9 +92,14 @@ | |||
// Update OriginalObjectTypeInput | |||
|
|||
// checking whether OriginalObjectTypeInput assigns null | |||
const inputNullRegex = new RegExp(`(export type Original${objectType}Input = null)`); | |||
const inputNullRegex = new RegExp( | |||
`(export type Original${objectType}Input = null)`, |
Check failure
Code scanning / CodeQL
Regular expression injection High
command-line argument
@@ -100,9 +112,14 @@ | |||
// Update OriginalObjectTypeOutput | |||
|
|||
// checking whether OriginalObjectTypeInput assigns null | |||
const outputNullRegex = new RegExp(`(export type Original${objectType}Input = null)`); | |||
const outputNullRegex = new RegExp( | |||
`(export type Original${objectType}Input = null)`, |
Check failure
Code scanning / CodeQL
Regular expression injection High
No description provided.