Skip to content
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
1 change: 1 addition & 0 deletions config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const AppConfig = {
inviteEmailSubject: process.env.INVITE_EMAIL_SUBJECT || 'You are invited to Topcoder',
inviteEmailSectionTitle: process.env.INVITE_EMAIL_SECTION_TITLE || 'Project Invitation',
SSO_REFCODES: process.env.SSO_REFCODES || '[]',
PROJECT_SERVICE_PRISMA_TIMEOUT: process.env.PROJECT_SERVICE_PRISMA_TIMEOUT ? parseInt(process.env.PROJECT_SERVICE_PRISMA_TIMEOUT) : 10000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
Consider using Number() instead of parseInt() for parsing PROJECT_SERVICE_PRISMA_TIMEOUT. parseInt() can produce unexpected results if the environment variable contains non-numeric characters, whereas Number() will return NaN in such cases, which might be safer for ensuring the timeout is a valid number.

}

export const Auth0Config = {
Expand Down
4 changes: 4 additions & 0 deletions src/shared/services/prisma.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// prisma.service.ts
import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
import { AppConfig } from 'config/config';

@Injectable()
export class PrismaService
Expand All @@ -9,6 +10,9 @@ export class PrismaService
{
constructor() {
super({
transactionOptions: {
timeout: AppConfig.PROJECT_SERVICE_PRISMA_TIMEOUT,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
Ensure that AppConfig.PROJECT_SERVICE_PRISMA_TIMEOUT is validated and has a sensible default value to prevent potential runtime errors or unintended behavior if the configuration is missing or incorrect.

},
log: [
{ level: 'query', emit: 'event' },
{ level: 'info', emit: 'event' },
Expand Down