Skip to content

Commit

Permalink
add isRecurringDonation and SUPER_TOKENS_CRITICAL fields and validators
Browse files Browse the repository at this point in the history
  • Loading branch information
RamRamez committed Mar 26, 2024
1 parent deb60b8 commit 7700be6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/services/notificationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES
attributes = {
"str:cm:tokensymbol": payload.tokenSymbol,
"str:cm:email": payload.email,
"str:cm:userId": payload.userId,
"str:cm:userId": payload.userId?.toString(),
"str:cm:criticalDate": payload.criticalDate,
"bol:cm:isended": payload.isEnded,
}
break;
case NOTIFICATIONS_EVENT_NAMES.DONATION_RECEIVED:
attributes = {
"bol:cm:isrecurringdonation": !!payload.isRecurringDonation,
"str:cm:projecttitle": payload.title,
"str:cm:donationamount": payload.amount.toString(),
"str:cm:donationtoken": payload.token,
Expand Down
2 changes: 2 additions & 0 deletions src/utils/validators/segmentAndMetadataValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const donationTrackerSchema = Joi.object({
donationValueEth: Joi.number().greater(0).allow(null),
verified: Joi.boolean().allow(null),
transakStatus: Joi.string().allow(null),
isRecurringDonation: Joi.boolean().allow(null),
});

const projectTitleProjectLinkSchema = Joi.object({
Expand Down Expand Up @@ -146,6 +147,7 @@ const superFluidTokenTrackerSchema = Joi.object({
email: Joi.string().required(),
userId: Joi.number().required(),
criticalDate: Joi.string().required(),
isEnded: Joi.boolean(),
});

export const SEGMENT_METADATA_SCHEMA_VALIDATOR: {
Expand Down
6 changes: 6 additions & 0 deletions src/validators/schemaValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ export const sendNotificationValidator = Joi.object({
donationValueEth: Joi.number().allow(null),
verified: Joi.boolean(),
transakStatus: Joi.string().allow(null).allow(''),
isRecurringDonation: Joi.boolean().allow(null),

//Super token critical attributes
criticalDate: Joi.string(),
isEnded: Joi.boolean(),
tokenSymbol: Joi.string(),

//Project related attributes
lastName: Joi.string().allow(null).allow(''),
Expand Down

0 comments on commit 7700be6

Please sign in to comment.