Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ortto External Embedded Webform for Onboarding guide #103

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -17,6 +17,7 @@ import { NotificationSetting } from './notificationSetting';
// Export Object with Schemas to N1 lookup
export const SCHEMA_VALIDATORS_NAMES = {
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 @@ -159,6 +159,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 @@ -176,6 +180,10 @@ export const SEGMENT_METADATA_SCHEMA_VALIDATOR: {
segment: createOrttoProfileSegmentSchema,
metadata: null
},
subscribeOnboarding: {
segment: subscribeOnboardingSchema,
metadata: null
},
userSuperTokensCritical: {
metadata: superFluidTokenMetadataSchema,
segment: superFluidTokenSegmentSchema,
Expand Down
Loading