-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from alkem-io/notifications-18
Notification recipients via YML
- Loading branch information
Showing
49 changed files
with
964 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ notification_providers: | |
# The hosting configuration for the Alkemio Server | ||
hosting: | ||
# The type of environment is used in multiple places to determine whether dev tooling is enabled. | ||
# The tyoe of environment can also be used for monitoring / logging / analysis in an ELK cluster / ElasticCloud instance. | ||
# The type of environment can also be used for monitoring / logging / analysis in an ELK cluster / ElasticCloud instance. | ||
# For production deployments it should be set to Prod. | ||
# | ||
# Options: Dev, Prod | ||
|
@@ -77,27 +77,27 @@ alkemio: | |
endpoint: ${ALKEMIO_SERVER_ENDPOINT}:http://localhost:3000/admin/graphql | ||
service_account: | ||
username: ${SERVICE_ACCOUNT_USERNAME}:[email protected] | ||
password: ${SERVICE_ACCOUNT_PASSWORD}:@lk3m10! | ||
password: ${SERVICE_ACCOUNT_PASSWORD}:obichamazis | ||
|
||
kratos: | ||
public_endpoint: ${KRATOS_API_PUBLIC_ENDPOINT}:http://localhost:3000/identity/ory/kratos/public | ||
|
||
templates: | ||
user_application_admin_template: | ||
- rule: | ||
type: ChallengeAdmin | ||
resource_id: <challengeID> | ||
- rule: | ||
type: OpportunityAdmin | ||
resource_id: <opportunityID> | ||
- rule: | ||
type: EcoverseAdmin | ||
resource_id: <ecoverseID> | ||
- rule: | ||
type: GlobalAdmin | ||
resource_id: <> | ||
|
||
user_application_applicant_template: | ||
- rule: | ||
type: UserSelfManagement | ||
resource_id: <applicantID> | ||
recipients: | ||
application_created: | ||
admin: | ||
- rule: | ||
type: CHALLENGE_ADMIN | ||
resource_id: <challengeID> | ||
- rule: | ||
type: OPPORTUNITY_ADMIN | ||
resource_id: <opportunityID> | ||
- rule: | ||
type: ECOVERSE_ADMIN | ||
resource_id: <ecoverseID> | ||
- rule: | ||
type: GLOBAL_ADMIN | ||
resource_id: <> | ||
applicant: | ||
- rule: | ||
type: USER_SELF_MANAGEMENT | ||
resource_id: <applicantID> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface IFeatureFlagProvider { | ||
areNotificationsEnabled(): Promise<boolean>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from './notified.users.provider.interface'; | ||
export * from './feature.flag.provider.interface'; | ||
export * from './notification.recipient.provider.interface'; | ||
export * from './notification.recipient.template.provider.interface'; |
14 changes: 14 additions & 0 deletions
14
src/core/contracts/notification.recipient.provider.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { AuthorizationCredential } from '@alkemio/client-lib'; | ||
import { ApplicationCreatedEventPayload } from '@src/types/application.created.event.payload'; | ||
|
||
export type RecipientCredential = { | ||
role: AuthorizationCredential; | ||
resourceID?: string; | ||
isAdmin: boolean; | ||
}; | ||
|
||
export interface INotificationRecipientProvider { | ||
getApplicationCreatedRecipients( | ||
payload: ApplicationCreatedEventPayload | ||
): RecipientCredential[]; | ||
} |
21 changes: 21 additions & 0 deletions
21
src/core/contracts/notification.recipient.template.provider.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { AuthorizationCredential } from '@alkemio/client-lib'; | ||
|
||
export type TemplateRule = { | ||
rule: { | ||
type: AuthorizationCredential; | ||
resource_id: string; | ||
}; | ||
}; | ||
|
||
export type TemplateRow = { | ||
admin: TemplateRule[]; | ||
applicant: TemplateRule[]; | ||
}; | ||
|
||
export type TemplateConfig = { | ||
application_created?: TemplateRow; | ||
}; | ||
|
||
export interface INotificationRecipientTemplateProvider { | ||
getTemplate(): TemplateConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { User } from '../models'; | ||
import { AuthorizationCredential } from '@alkemio/client-lib'; | ||
|
||
export interface INotifiedUsersProvider { | ||
getHubAdmins(hubID: string): Promise<User[]> | User[]; | ||
getChallengeAdmins(challengeID: string): Promise<User[]> | User[]; | ||
getOpportunityAdmins(opportunityID: string): Promise<User[]> | User[]; | ||
getApplicant(payload: any): Promise<User> | User; | ||
getUsersWithCredentials( | ||
credential: AuthorizationCredential, | ||
resourceID?: string | ||
): Promise<User[]>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './user'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export type User = { | ||
id: string; | ||
nameID: string; | ||
firstName: string; | ||
lastName: string; | ||
displayName: string; | ||
email: string; | ||
}; |
Oops, something went wrong.