From d7cde69eb0e8094d9995f3b3eb82d60f1e8a1b76 Mon Sep 17 00:00:00 2001 From: WRadoslaw Date: Mon, 6 May 2024 11:24:19 +0200 Subject: [PATCH] Add CRT input to notification mutation --- .../resolvers/NotificationResolver/index.ts | 36 ++++++++++ .../resolvers/NotificationResolver/types.ts | 67 +++++++++++++++++++ 2 files changed, 103 insertions(+) diff --git a/src/server-extension/resolvers/NotificationResolver/index.ts b/src/server-extension/resolvers/NotificationResolver/index.ts index 8d90348ee..9d95cf1e0 100644 --- a/src/server-extension/resolvers/NotificationResolver/index.ts +++ b/src/server-extension/resolvers/NotificationResolver/index.ts @@ -188,6 +188,42 @@ export class NotificationResolver { newPreferences.fundsFromWgReceived, account.notificationPreferences.fundsFromWgReceived ) + maybeUpdateNotificationPreference( + newPreferences.crtIssued, + account.notificationPreferences.crtIssued + ) + maybeUpdateNotificationPreference( + newPreferences.crtMarketStarted, + account.notificationPreferences.crtMarketStarted + ) + maybeUpdateNotificationPreference( + newPreferences.crtMarketMint, + account.notificationPreferences.crtMarketMint + ) + maybeUpdateNotificationPreference( + newPreferences.crtMarketBurn, + account.notificationPreferences.crtMarketBurn + ) + maybeUpdateNotificationPreference( + newPreferences.crtSaleStarted, + account.notificationPreferences.crtSaleStarted + ) + maybeUpdateNotificationPreference( + newPreferences.crtSaleMint, + account.notificationPreferences.crtSaleMint + ) + maybeUpdateNotificationPreference( + newPreferences.crtRevenueShareStarted, + account.notificationPreferences.crtRevenueShareStarted + ) + maybeUpdateNotificationPreference( + newPreferences.crtRevenueSharePlanned, + account.notificationPreferences.crtRevenueSharePlanned + ) + maybeUpdateNotificationPreference( + newPreferences.crtRevenueShareEnded, + account.notificationPreferences.crtRevenueShareEnded + ) await em.save(account) return toOutputGQL(account.notificationPreferences) diff --git a/src/server-extension/resolvers/NotificationResolver/types.ts b/src/server-extension/resolvers/NotificationResolver/types.ts index 4ce02249f..29c9930ce 100644 --- a/src/server-extension/resolvers/NotificationResolver/types.ts +++ b/src/server-extension/resolvers/NotificationResolver/types.ts @@ -130,6 +130,35 @@ export class AccountNotificationPreferencesInput { @Field(() => NotificationPreferenceGQL, { nullable: true }) fundsFromWgReceived: NotificationPreference + + // CRTs + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtIssued: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtMarketStarted: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtMarketMint: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtMarketBurn: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtSaleStarted: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtSaleMint: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtRevenueShareStarted: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtRevenueSharePlanned: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtRevenueShareEnded: NotificationPreference } @ObjectType() @@ -233,6 +262,35 @@ export class AccountNotificationPreferencesOutput @Field(() => NotificationPreferenceOutput, { nullable: true }) fundsFromWgReceived: NotificationPreference + + // CRTs + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtIssued: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtMarketStarted: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtMarketMint: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtMarketBurn: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtSaleStarted: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtSaleMint: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtRevenueShareStarted: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtRevenueSharePlanned: NotificationPreference + + @Field(() => NotificationPreferenceGQL, { nullable: true }) + crtRevenueShareEnded: NotificationPreference } @ObjectType() @@ -277,5 +335,14 @@ export function toOutputGQL( fundsFromCouncilReceived: preferences.fundsFromCouncilReceived, fundsToExternalWalletSent: preferences.fundsToExternalWalletSent, fundsFromWgReceived: preferences.fundsFromWgReceived, + crtIssued: preferences.crtIssued, + crtMarketStarted: preferences.crtMarketStarted, + crtMarketMint: preferences.crtMarketMint, + crtMarketBurn: preferences.crtMarketBurn, + crtSaleStarted: preferences.crtSaleStarted, + crtSaleMint: preferences.crtSaleMint, + crtRevenueShareStarted: preferences.crtRevenueShareStarted, + crtRevenueSharePlanned: preferences.crtRevenueSharePlanned, + crtRevenueShareEnded: preferences.crtRevenueShareEnded, } }