diff --git a/migrations/1718888344202-seedNotificationTypeForNotifyRewardAmount.ts b/migrations/1718888344202-seedNotificationTypeForNotifyRewardAmount.ts index 0cb4861..bdf55ae 100644 --- a/migrations/1718888344202-seedNotificationTypeForNotifyRewardAmount.ts +++ b/migrations/1718888344202-seedNotificationTypeForNotifyRewardAmount.ts @@ -1,27 +1,38 @@ -import { MigrationInterface, QueryRunner } from "typeorm" -import { NOTIFICATION_CATEGORY, NOTIFICATION_TYPE_NAMES } from '../src/types/general'; +import { MigrationInterface, QueryRunner } from 'typeorm'; +import { + NOTIFICATION_CATEGORY, + NOTIFICATION_TYPE_NAMES, +} from '../src/types/general'; import { MICRO_SERVICES } from '../src/utils/utils'; -import { NotificationType, SCHEMA_VALIDATORS_NAMES } from '../src/entities/notificationType'; +import { + NotificationType, + SCHEMA_VALIDATORS_NAMES, +} from '../src/entities/notificationType'; const NotifyRewardAmountNotificationType = [ - { - name: NOTIFICATION_TYPE_NAMES.NOTIFY_REWARD_AMOUNT, - description: NOTIFICATION_TYPE_NAMES.NOTIFY_REWARD_AMOUNT, - microService: MICRO_SERVICES.givethio, - category: NOTIFICATION_CATEGORY.NOTIFY_REWARD_AMOUNT, - schemaValidator: SCHEMA_VALIDATORS_NAMES.NOTIFY_REWARD_AMOUNT, - title: "Notify reward report", - } -] + { + name: NOTIFICATION_TYPE_NAMES.NOTIFY_REWARD_AMOUNT, + description: NOTIFICATION_TYPE_NAMES.NOTIFY_REWARD_AMOUNT, + microService: MICRO_SERVICES.givethio, + category: NOTIFICATION_CATEGORY.NOTIFY_REWARD_AMOUNT, + schemaValidator: SCHEMA_VALIDATORS_NAMES.NOTIFY_REWARD_AMOUNT, + title: 'Notify reward report', + }, +]; -export class seedNotificationTypeForNotifyRewardAmount1718888344202 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.manager.save(NotificationType, NotifyRewardAmountNotificationType); - } +export class seedNotificationTypeForNotifyRewardAmount1718888344202 + implements MigrationInterface +{ + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.manager.save( + NotificationType, + NotifyRewardAmountNotificationType, + ); + } - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `DELETE FROM notification_type WHERE "name" = ${NOTIFICATION_TYPE_NAMES.NOTIFY_REWARD_AMOUNT};`, - ); - } + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `DELETE FROM notification_type WHERE "name" = ${NOTIFICATION_TYPE_NAMES.NOTIFY_REWARD_AMOUNT};`, + ); + } } diff --git a/src/services/notificationService.ts b/src/services/notificationService.ts index 73f69db..f41acc3 100644 --- a/src/services/notificationService.ts +++ b/src/services/notificationService.ts @@ -167,25 +167,25 @@ const activityCreator = ( break; case NOTIFICATIONS_EVENT_NAMES.PROJECT_BADGE_REVOKE_LAST_WARNING: attributes = { - "str:cm:projecttitle": payload.title, - "str:cm:email": payload.email, - "str:cm:projectupdatelink": payload.projectLink + '?tab=updates', - "str:cm:userid": payload.userId?.toString(), - } - break + 'str:cm:projecttitle': payload.title, + 'str:cm:email': payload.email, + 'str:cm:projectupdatelink': payload.projectLink + '?tab=updates', + 'str:cm:userid': payload.userId?.toString(), + }; + break; case NOTIFICATIONS_EVENT_NAMES.NOTIFY_REWARD_AMOUNT: attributes = { - "int:cm:round": payload.round, - "str:cm:date": payload.date, - "str:cm:amount": payload.amount, - "str:cm:contractaddress": payload.contractAddress, - "str:cm:farm": payload.farm, - "str:cm:message": payload.message, - "str:cm:network": payload.network, - "str:cm:script": payload.script, - "str:cm:transactionhash": payload.transactionHash, - } - break + 'int:cm:round': payload.round, + 'str:cm:date': payload.date, + 'str:cm:amount': payload.amount, + 'str:cm:contractaddress': payload.contractAddress, + 'str:cm:farm': payload.farm, + 'str:cm:message': payload.message, + 'str:cm:network': payload.network, + 'str:cm:script': payload.script, + 'str:cm:transactionhash': payload.transactionHash, + }; + break; default: logger.debug('activityCreator() invalid event name', orttoEventName); return; diff --git a/src/types/notifications.ts b/src/types/notifications.ts index 9c1a81c..c773c56 100644 --- a/src/types/notifications.ts +++ b/src/types/notifications.ts @@ -77,6 +77,7 @@ export const ORTTO_EVENT_NAMES: any = { [NOTIFICATIONS_EVENT_NAMES.PROJECT_BADGE_REVOKE_LAST_WARNING]: 'second-update-warning', [NOTIFICATIONS_EVENT_NAMES.CREATE_ORTTO_PROFILE]: 'created-profile', - [NOTIFICATIONS_EVENT_NAMES.SEND_EMAIL_CONFIRMATION]: 'verification-form-email-verification', - [NOTIFICATIONS_EVENT_NAMES.NOTIFY_REWARD_AMOUNT]: 'notify-reward-amount' -} \ No newline at end of file + [NOTIFICATIONS_EVENT_NAMES.SEND_EMAIL_CONFIRMATION]: + 'verification-form-email-verification', + [NOTIFICATIONS_EVENT_NAMES.NOTIFY_REWARD_AMOUNT]: 'notify-reward-amount', +}; diff --git a/src/utils/validators/segmentAndMetadataValidators.ts b/src/utils/validators/segmentAndMetadataValidators.ts index 0ba7c14..d62a837 100644 --- a/src/utils/validators/segmentAndMetadataValidators.ts +++ b/src/utils/validators/segmentAndMetadataValidators.ts @@ -171,7 +171,7 @@ const notifyRewardAmountSegmentSchema = Joi.object({ network: Joi.string().required(), script: Joi.string().required(), transactionHash: Joi.string().required(), -}) +}); export const SEGMENT_METADATA_SCHEMA_VALIDATOR: { [key: string]: {