Skip to content

Commit

Permalink
Add CRT input to notification mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw committed May 6, 2024
1 parent b3d3553 commit d7cde69
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/server-extension/resolvers/NotificationResolver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
67 changes: 67 additions & 0 deletions src/server-extension/resolvers/NotificationResolver/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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,
}
}

0 comments on commit d7cde69

Please sign in to comment.