Skip to content

Commit

Permalink
Merge pull request #332 from alkem-io/develop
Browse files Browse the repository at this point in the history
Release: Platform Invitations
  • Loading branch information
valentinyanakiev authored Jun 28, 2024
2 parents 0eb194e + 63458a3 commit b11b623
Show file tree
Hide file tree
Showing 61 changed files with 4,211 additions and 934 deletions.
4,664 changes: 3,950 additions & 714 deletions lib/package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alkemio/notifications-lib",
"version": "0.8.5",
"version": "0.9.3",
"description": "Library for interacting with Alkemio notifications service",
"author": "Alkemio Foundation",
"private": false,
Expand All @@ -20,10 +20,14 @@
"lint:prod": "tsc --noEmit && cross-env NODE_ENV=production eslint src/**/*.ts{,x}",
"lint:fix": "tsc --noEmit && eslint src/**/*.ts{,x} --fix"
},
"dependencies": {
"@alkemio/client-lib": "^0.32.0"
},
"devDependencies": {
"@types/node": "^16.4.6",
"@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.28.5",
"dotenv": "^16.0.1",
"eslint": "^7.31.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
Expand Down
6 changes: 0 additions & 6 deletions lib/src/common/enums/space.type.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { CommunityInvitationCreatedEventPayload } from './community.invitation.created.event.payload';
import { ContributorPayload } from './contributor.payload';

export interface CommunityInvitationVirtualContributorCreatedEventPayload extends CommunityInvitationCreatedEventPayload {
host: ContributorPayload;
}
2 changes: 1 addition & 1 deletion lib/src/dto/community.new.member.payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { ContributorPayload } from './contributor.payload';
import { SpaceBaseEventPayload } from './space.base.event.payload';

export interface CommunityNewMemberPayload extends SpaceBaseEventPayload {
user: ContributorPayload;
contributor: ContributorPayload;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SpaceBaseEventPayload } from './space.base.event.payload';
export interface CommunityExternalInvitationCreatedEventPayload
export interface CommunityPlatformInvitationCreatedEventPayload
extends SpaceBaseEventPayload {
invitees: {
email: string;
Expand Down
3 changes: 1 addition & 2 deletions lib/src/dto/contributor.payload.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { SpaceType } from "@src/common/enums/space.type";

export type ContributorPayload = {
id: string;
nameID: string;
profile: {
displayName: string;
url: string;
}
type: string
};
5 changes: 3 additions & 2 deletions lib/src/dto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export * from './communication.organization.mention.event.payload';
export * from './community.application.created.event.payload';
export * from './community.new.member.payload';
export * from './community.invitation.created.event.payload';
export * from './community.external.invitation.created.event.payload';
export * from './community.platform.invitation.created.event.payload';
export * from './collaboration.whiteboard.created.event.payload';
export * from './collaboration.post.created.event.payload';
export * from './collaboration.post.comment.event.payload';
Expand All @@ -20,7 +20,8 @@ export * from './collaboration.discussion.comment.event.payload';
export * from './platform.global.role.change.event.payload';
export * from './platform.user.registration.event.payload';
export * from './platform.user.removed.event.payload';
export * from './platform.user.invited.to.role.event.payload';
export * from './platform.forum.discussion.comment.event.payload';
export * from './platform.forum.discussion.created.event.payload';
export * from './comment.reply.event.payload';
export * from './virtual.contributor.invitation.created.event.payload';
export * from './community.invitation.virtual.contributor.created.event.payload';
13 changes: 13 additions & 0 deletions lib/src/dto/platform.user.invited.to.role.event.payload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { PlatformRole } from "@alkemio/client-lib";
import { BaseEventPayload } from "./base.event.payload";
import { ContributorPayload } from "./contributor.payload";

export interface PlatformUserInvitedToRoleEventPayload
extends BaseEventPayload {
user: ContributorPayload;
role: PlatformRole;
invitees: {
email: string;
}[];
welcomeMessage?: string;
};
4 changes: 1 addition & 3 deletions lib/src/dto/space.payload.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { SpaceType } from "@src/common/enums/space.type";

export type SpacePayload = {
id: string;
nameID: string;
type: SpaceType;
type: string;
profile: {
displayName: string;
url: string;
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion lib/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './notification.event.type';
export * from './dto';
export * from './common/enums/space.type';
export * from './common/enums/role.change.type';
3 changes: 2 additions & 1 deletion lib/src/notification.event.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export enum NotificationEventType {
COMMUNITY_APPLICATION_CREATED = 'communityApplicationCreated',
COMMUNITY_NEW_MEMBER = 'communityNewMember',
COMMUNITY_INVITATION_CREATED = 'communityInvitationCreated',
COMMUNITY_EXTERNAL_INVITATION_CREATED = 'communityExternalInvitationCreated',
COMMUNITY_PLATFORM_INVITATION_CREATED = 'communityPlatformInvitationCreated',
COMMUNICATION_COMMENT_SENT = 'communicationCommentSent',
COMMUNICATION_UPDATE_SENT = 'communicationUpdateSent',
COMMUNICATION_USER_MESSAGE = 'communicationUserMessage',
Expand All @@ -16,6 +16,7 @@ export enum NotificationEventType {
COLLABORATION_DISCUSSION_COMMENT = 'collaborationCommentOnDiscussion',
COLLABORATION_CALLOUT_PUBLISHED = 'collaborationCalloutPublished',
PLATFORM_USER_REGISTERED = 'platformUserRegistered',
PLATFORM_USER_INVITED_TO_ROLE = 'platformUserInvitedToRole',
PLATFORM_USER_REMOVED = 'platformUserRemoved',
PLATFORM_GLOBAL_ROLE_CHANGE = 'platformGlobalRoleChange',
PLATFORM_FORUM_DISCUSSION_COMMENT = 'platformForumDiscussionComment',
Expand Down
4 changes: 2 additions & 2 deletions service/notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ recipients:
- rule:
type: USER_SELF_MANAGEMENT
resource_id: <inviteeID>
community_external_invitation_created:
community_platform_invitation_created:
- name: inviter
rules:
- rule:
Expand All @@ -131,7 +131,7 @@ recipients:
- name: invitee
rules:
- rule:
type: EXTERNAL_USER
type: PLATFORM_USER
resource_id:
communication_update_sent:
- name: admin
Expand Down
70 changes: 50 additions & 20 deletions service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions service/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alkemio-notifications",
"version": "0.17.3",
"version": "0.18.0",
"description": "Alkemio notifications service",
"author": "Alkemio Foundation",
"private": false,
Expand Down Expand Up @@ -35,8 +35,8 @@
"validate-connection": "ts-node src/utils/validate-connection.ts"
},
"dependencies": {
"@alkemio/client-lib": "^0.29.4",
"@alkemio/notifications-lib": "^0.8.5",
"@alkemio/client-lib": "^0.32.0",
"@alkemio/notifications-lib": "^0.9.3",
"@nestjs/common": "^8.0.5",
"@nestjs/config": "^1.0.1",
"@nestjs/core": "^8.0.5",
Expand Down Expand Up @@ -72,6 +72,7 @@
"@typescript-eslint/parser": "^4.28.5",
"cd": "^0.3.3",
"coveralls": "^3.1.1",
"dotenv": "^16.0.1",
"eslint": "^7.31.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
Expand Down
17 changes: 9 additions & 8 deletions service/src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ import {
PlatformForumDiscussionCommentEventPayload,
CommunityInvitationCreatedEventPayload,
CommentReplyEventPayload,
CommunityInvitationVirtualContributorCreatedEventPayload,
} from '@alkemio/notifications-lib';
import { NotificationService } from './services/domain/notification/notification.service';
import { ALKEMIO_CLIENT_ADAPTER, LogContext } from './common/enums';
import { CommunityExternalInvitationCreatedEventPayload } from '@alkemio/notifications-lib';
import { VirtualContributorInvitationCreatedEventPayload } from '@alkemio/notifications-lib/dist/dto/virtual.contributor.invitation.created.event.payload';
import { CommunityPlatformInvitationCreatedEventPayload } from '@alkemio/notifications-lib';

@Controller()
export class AppController {
Expand Down Expand Up @@ -81,7 +81,8 @@ export class AppController {

@EventPattern(NotificationEventType.COMMUNITY_INVITATION_CREATED_VC)
async sendVirtualContributorInvitationCreatedNotifications(
@Payload() eventPayload: VirtualContributorInvitationCreatedEventPayload,
@Payload()
eventPayload: CommunityInvitationVirtualContributorCreatedEventPayload,
@Ctx() context: RmqContext
) {
this.sendNotifications(
Expand All @@ -94,19 +95,19 @@ export class AppController {
);
}

@EventPattern(NotificationEventType.COMMUNITY_EXTERNAL_INVITATION_CREATED)
async sendExternalInvitationNotification(
@EventPattern(NotificationEventType.COMMUNITY_PLATFORM_INVITATION_CREATED)
async sendCommunityPlatformInvitationNotification(
// todo is auto validation possible
@Payload() eventPayload: CommunityExternalInvitationCreatedEventPayload,
@Payload() eventPayload: CommunityPlatformInvitationCreatedEventPayload,
@Ctx() context: RmqContext
) {
this.sendNotifications(
eventPayload,
context,
this.notificationService.sendExternalInvitationCreatedNotifications(
this.notificationService.sendCommunityPlatformInvitationCreatedNotifications(
eventPayload
),
NotificationEventType.COMMUNITY_EXTERNAL_INVITATION_CREATED
NotificationEventType.COMMUNITY_PLATFORM_INVITATION_CREATED
);
}

Expand Down
Loading

0 comments on commit b11b623

Please sign in to comment.