Skip to content

Commit

Permalink
remove sonar cloud issue
Browse files Browse the repository at this point in the history
  • Loading branch information
poojakarma committed Oct 24, 2024
1 parent 20a588c commit 45bbdb4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 26 deletions.
16 changes: 6 additions & 10 deletions src/modules/notification/adapters/pushService.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,11 @@ export class PushAdapter implements NotificationServiceInterface {
}

async getAccessToken() {
try {
const token = await admin.credential.cert({
projectId: this.configService.get('FIREBASE_PROJECT_ID'),
clientEmail: this.configService.get('FIREBASE_CLIENT_EMAIL'),
privateKey: this.configService.get('FIREBASE_PRIVATE_KEY').replace(/\\n/g, '\n'),
}).getAccessToken();
return token.access_token;
} catch (error) {
throw error;
}
const token = await admin.credential.cert({
projectId: this.configService.get('FIREBASE_PROJECT_ID'),
clientEmail: this.configService.get('FIREBASE_CLIENT_EMAIL'),
privateKey: this.configService.get('FIREBASE_PRIVATE_KEY').replace(/\\n/g, '\n'),
}).getAccessToken();
return token.access_token;
}
}
28 changes: 12 additions & 16 deletions src/modules/notification/notification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,20 @@ export class NotificationService {

//Provider which store in Queue
async saveNotificationQueue(notificationDataArray) {
try {
const arrayofResult = await this.notificationQueue.save(notificationDataArray);
if (arrayofResult) {
if (this.amqpConnection && arrayofResult) {
try {
for (const result of arrayofResult) {
this.amqpConnection.publish('notification.exchange', 'notification.route', result, { persistent: true });
}
}
catch (e) {
throw e;
const arrayofResult = await this.notificationQueue.save(notificationDataArray);
if (arrayofResult) {
if (this.amqpConnection) {
try {
for (const result of arrayofResult) {
this.amqpConnection.publish('notification.exchange', 'notification.route', result, { persistent: true });
}
}
return arrayofResult;
catch (e) {
this.logger.error('/error to save in notification in rabbitMq', e)
throw e;
}
}
}
catch (e) {
throw e;
return arrayofResult;
}
}

Expand Down Expand Up @@ -362,7 +358,7 @@ export class NotificationService {

async saveNotificationLogs(notificationLogs: NotificationLog) {
try {
const result = await this.notificationLogRepository.save(notificationLogs);
await this.notificationLogRepository.save(notificationLogs);
}
catch (e) {
this.logger.error(
Expand Down

0 comments on commit 45bbdb4

Please sign in to comment.