Skip to content

Commit

Permalink
Merge pull request #103 from Giveth/Replace-ortto-External-Embedded-W…
Browse files Browse the repository at this point in the history
…ebform-for-Onboarding-guide

Replace ortto External Embedded Webform for Onboarding guide
  • Loading branch information
RamRamez authored Jul 1, 2024
2 parents 06353a9 + 92571c9 commit 9cae75a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
26 changes: 26 additions & 0 deletions migrations/1719410008992-seedNotificationTypeForOnboardingGuide.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { MigrationInterface, QueryRunner } from "typeorm"
import { NotificationType, SCHEMA_VALIDATORS_NAMES } from '../src/entities/notificationType';
import { NOTIFICATION_CATEGORY, NOTIFICATION_TYPE_NAMES } from '../src/types/general';
import { MICRO_SERVICES } from '../src/utils/utils';

const OnboardingNotificationType = [
{
name: NOTIFICATION_TYPE_NAMES.SUBSCRIBE_ONBOARDING,
description: NOTIFICATION_TYPE_NAMES.SUBSCRIBE_ONBOARDING,
microService: MICRO_SERVICES.givethio,
category: NOTIFICATION_CATEGORY.ORTTO,
schemaValidator: SCHEMA_VALIDATORS_NAMES.SUBSCRIBE_ONBOARDING,
}
]

export class seedNotificationTypeForOnboardingGuide1719410008992 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.manager.save(NotificationType, OnboardingNotificationType);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DELETE FROM notification_type WHERE "name" = 'Subscribe onboarding';`,
);
}
}
1 change: 1 addition & 0 deletions src/entities/notificationType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { NotificationSetting } from './notificationSetting';
export const SCHEMA_VALIDATORS_NAMES = {
SEND_EMAIL_CONFIRMATION: 'sendEmailConfirmation',
CREATE_ORTTO_PROFILE: 'createOrttoProfile',
SUBSCRIBE_ONBOARDING: 'subscribeOnboarding',
SUPERFLUID: 'userSuperTokensCritical',
ADMIN_MESSAGE: 'adminMessage',
RAW_HTML_BROADCAST: 'rawHtmlBroadcast',
Expand Down
1 change: 1 addition & 0 deletions src/types/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ export enum NOTIFICATION_TYPE_NAMES {
PROJECT_HAS_A_NEW_RANK = 'Your project has a new rank',
PROJECT_HAS_RISEN_IN_THE_RANK = 'Your Project has risen in the rank',
YOUR_PROJECT_GOT_A_RANK = 'Your project got a rank',
SUBSCRIBE_ONBOARDING = 'Subscribe onboarding',
CREATE_ORTTO_PROFILE = 'Create Ortto profile',
}
8 changes: 8 additions & 0 deletions src/utils/validators/segmentAndMetadataValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ const superFluidTokenSegmentSchema = Joi.object({
isEnded: Joi.boolean(),
});

const subscribeOnboardingSchema = Joi.object({
email: Joi.string().required(),
})

const createOrttoProfileSegmentSchema = Joi.object({
email: Joi.string().required(),
firstName: Joi.string().required(),
Expand All @@ -186,6 +190,10 @@ export const SEGMENT_METADATA_SCHEMA_VALIDATOR: {
segment: createOrttoProfileSegmentSchema,
metadata: null
},
subscribeOnboarding: {
segment: subscribeOnboardingSchema,
metadata: null
},
userSuperTokensCritical: {
metadata: superFluidTokenMetadataSchema,
segment: superFluidTokenSegmentSchema,
Expand Down

0 comments on commit 9cae75a

Please sign in to comment.