Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RamRamez committed Jul 2, 2024
1 parent 8a0d320 commit e386b60
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -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<void> {
await queryRunner.manager.save(NotificationType, NotifyRewardAmountNotificationType);
}
export class seedNotificationTypeForNotifyRewardAmount1718888344202
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.manager.save(
NotificationType,
NotifyRewardAmountNotificationType,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DELETE FROM notification_type WHERE "name" = ${NOTIFICATION_TYPE_NAMES.NOTIFY_REWARD_AMOUNT};`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DELETE FROM notification_type WHERE "name" = ${NOTIFICATION_TYPE_NAMES.NOTIFY_REWARD_AMOUNT};`,
);
}
}
34 changes: 17 additions & 17 deletions src/services/notificationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions src/types/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
[NOTIFICATIONS_EVENT_NAMES.SEND_EMAIL_CONFIRMATION]:
'verification-form-email-verification',
[NOTIFICATIONS_EVENT_NAMES.NOTIFY_REWARD_AMOUNT]: 'notify-reward-amount',
};
2 changes: 1 addition & 1 deletion src/utils/validators/segmentAndMetadataValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]: {
Expand Down

0 comments on commit e386b60

Please sign in to comment.