Skip to content

Commit

Permalink
Merge pull request #4573 from alkem-io/develop
Browse files Browse the repository at this point in the history
[0.92.0] Whiteboard server-side master
  • Loading branch information
hero101 authored Sep 30, 2024
2 parents 38e377c + 4a92a0c commit 2fccb25
Show file tree
Hide file tree
Showing 46 changed files with 285 additions and 307 deletions.
3 changes: 3 additions & 0 deletions alkemio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@ platform:
# Acceptable Usage Policy
aup: ${PLATFORM_AUP}:https://www.alkemio.org/legal/hub/#aup

# Documentation site path, endpoint is endpoint_cluster + documentation_path
documentation_path: ${PLATFORM_DOCUMENTATION_PATH}:/documentation

# Client can optionally work with a landing page, to give additional information
landing_page:
enabled: ${LANDING_PAGE_ENABLED}:false
Expand Down
6 changes: 0 additions & 6 deletions graphql-samples/subscriptions/whiteboardContentUpdated

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alkemio-server",
"version": "0.91.0",
"version": "0.92.0",
"description": "Alkemio server, responsible for managing the shared Alkemio platform",
"author": "Alkemio Foundation",
"private": false,
Expand Down
4 changes: 0 additions & 4 deletions src/common/constants/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ export const SUBSCRIPTION_DISCUSSION_UPDATED =
'alkemio-subscriptions-discussion-updated';
export const SUBSCRIPTION_VIRTUAL_CONTRIBUTOR_UPDATED =
'alkemio-subscriptions-vritual-contributor-updated';
export const SUBSCRIPTION_WHITEBOARD_CONTENT =
'alkemio-subscriptions-whiteboard-content';
export const SUBSCRIPTION_WHITEBOARD_SAVED =
'alkemio-subscriptions-whiteboard-saved';
export const SUBSCRIPTION_CALLOUT_POST_CREATED =
'alkemio-subscriptions-callout-post-created';
export const SUBSCRIPTION_PROFILE_VERIFIED_CREDENTIAL =
Expand Down
1 change: 1 addition & 0 deletions src/common/enums/logging.context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export enum LogContext {
CHAT_GUIDANCE_REPORTER = 'chat-guidance-reporter',
TAGSET = 'tagset',
EXCALIDRAW_SERVER = 'excalidraw-server',
WHITEBOARD_INTEGRATION = 'whiteboard-integration',
RESOLVER_FIELD = 'resolver-field',
RESOLVER_QUERY = 'resolver-query',
MUTATION = 'mutation',
Expand Down
2 changes: 1 addition & 1 deletion src/common/enums/messaging.queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export enum MessagingQueue {
SUBSCRIPTION_ACTIVITY_CREATED = 'alkemio-subscriptions-activity-created',
SUBSCRIPTION_ROOM_EVENT = 'alkemio-subscriptions-room-event',
//
AUTH = 'auth',
WHITEBOARDS = 'alkemio-whiteboards',
FILES = 'alkemio-files',
}
2 changes: 2 additions & 0 deletions src/common/enums/space.reserved.name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ export enum SpaceReservedName {
ABOUT = 'about',
PROFILE = 'profile',
RESTRICTED = 'restricted',
DOCS = 'docs',
DOCUMENTATION = 'documentation',
}
3 changes: 0 additions & 3 deletions src/common/enums/subscription.type.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
export enum SubscriptionType {
COMMUNICATION_ROOM_MESSAGE_RECEIVED = 'communicationRoomMessageReceived', // todo remove
FORUM_DISCUSSION_UPDATED = 'forumDiscussionUpdated',
WHITEBOARD_CONTENT_UPDATED = 'whiteboardContentUpdated',
WHITEBOARD_SAVED = 'whiteboardSaved',
PROFILE_VERIFIED_CREDENTIAL = 'profileVerifiedCredential',
CALLOUT_POST_CREATED = 'calloutPostCreated',
SUBSPACE_CREATED = 'subspaceCreated',
Expand Down
10 changes: 0 additions & 10 deletions src/core/microservices/microservices.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { randomUUID } from 'crypto';
import {
NOTIFICATIONS_SERVICE,
MATRIX_ADAPTER_SERVICE,
SUBSCRIPTION_WHITEBOARD_CONTENT,
SUBSCRIPTION_CALLOUT_POST_CREATED,
WALLET_MANAGEMENT_SERVICE,
SUBSCRIPTION_PROFILE_VERIFIED_CREDENTIAL,
Expand All @@ -17,7 +16,6 @@ import {
VIRTUAL_CONTRIBUTOR_ENGINE_COMMUNITY_MANAGER,
VIRTUAL_CONTRIBUTOR_ENGINE_EXPERT,
VIRTUAL_CONTRIBUTOR_ENGINE_GUIDANCE,
SUBSCRIPTION_WHITEBOARD_SAVED,
SUBSCRIPTION_VIRTUAL_CONTRIBUTOR_UPDATED,
} from '@common/constants/providers';
import { MessagingQueue } from '@common/enums/messaging.queue';
Expand All @@ -39,10 +37,6 @@ const subscriptionConfig: { provide: string; queueName: MessagingQueue }[] = [
provide: SUBSCRIPTION_DISCUSSION_UPDATED,
queueName: MessagingQueue.SUBSCRIPTION_DISCUSSION_UPDATED,
},
{
provide: SUBSCRIPTION_WHITEBOARD_CONTENT,
queueName: MessagingQueue.SUBSCRIPTION_WHITEBOARD_CONTENT,
},
{
provide: SUBSCRIPTION_CALLOUT_POST_CREATED,
queueName: MessagingQueue.SUBSCRIPTION_CALLOUT_POST_CREATED,
Expand All @@ -59,10 +53,6 @@ const subscriptionConfig: { provide: string; queueName: MessagingQueue }[] = [
provide: SUBSCRIPTION_ROOM_EVENT,
queueName: MessagingQueue.SUBSCRIPTION_ROOM_EVENT,
},
{
provide: SUBSCRIPTION_WHITEBOARD_SAVED,
queueName: MessagingQueue.SUBSCRIPTION_WHITEBOARD_SAVED,
},
{
provide: SUBSCRIPTION_VIRTUAL_CONTRIBUTOR_UPDATED,
queueName: MessagingQueue.SUBSCRIPTION_VIRTUAL_CONTRIBUTOR_UPDATED,
Expand Down
3 changes: 3 additions & 0 deletions src/domain/collaboration/callout/callout.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export class Callout extends AuthorizableEntity implements ICallout {
@Column('text', { nullable: false })
type!: CalloutType;

@Column({ type: 'boolean', nullable: false, default: false })
isTemplate!: boolean;

@Column('char', { length: UUID_LENGTH, nullable: true })
createdBy?: string;

Expand Down
2 changes: 2 additions & 0 deletions src/domain/collaboration/callout/dto/callout.dto.create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ export class CreateCalloutInput {
'Controls if the comments are enabled for this Callout. Defaults to false.',
})
enableComments?: boolean;

isTemplate?: boolean;
}
2 changes: 0 additions & 2 deletions src/domain/common/whiteboard/dto/subscription/index.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { UUID } from '@domain/common/scalars/scalar.uuid';
import { InputType, Field } from '@nestjs/graphql';
import { InputType, Field, OmitType } from '@nestjs/graphql';
import { UpdateWhiteboardInput } from './whiteboard.dto.update';

@InputType()
export class UpdateWhiteboardEntityInput extends UpdateWhiteboardInput {
// omit the content from this input type
export class UpdateWhiteboardEntityInput extends OmitType(
UpdateWhiteboardInput,
['content']
) {
@Field(() => UUID, { nullable: false })
ID!: string;
}
1 change: 0 additions & 1 deletion src/domain/common/whiteboard/events/event.names.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/domain/common/whiteboard/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from './dto/whiteboard.dto.create';
export * from './dto/whiteboard.dto.update';
export * from './dto/whiteboard.dto.update.entity';
export * from './dto/whiteboard.dto.update.content';

export * from './whiteboard.entity';
export * from './whiteboard.interface';
16 changes: 14 additions & 2 deletions src/domain/common/whiteboard/whiteboard.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,27 @@ export class Whiteboard extends NameableEntity implements IWhiteboard {
@BeforeUpdate()
async compressValue() {
if (this.content !== '') {
this.content = await compressText(this.content);
try {
this.content = await compressText(this.content);
} catch (e) {
this.content = '';
// rethrow to be caught higher, does not crash the server
throw new Error('Failed to compress content');
}
}
}
@AfterInsert()
@AfterUpdate()
@AfterLoad()
async decompressValue() {
if (this.content !== '') {
this.content = await decompressText(this.content);
try {
this.content = await decompressText(this.content);
} catch (e: any) {
this.content = '';
// rethrow to be caught higher, does not crash the server
throw new Error(`Failed to decompress content: ${e?.message}`);
}
}
}

Expand Down
4 changes: 0 additions & 4 deletions src/domain/common/whiteboard/whiteboard.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import { WhiteboardAuthorizationService } from './whiteboard.service.authorizati
import { StorageBucketModule } from '@domain/storage/storage-bucket/storage.bucket.module';
import { ProfileDocumentsModule } from '@domain/profile-documents/profile.documents.module';
import { LicenseEngineModule } from '@core/license-engine/license.engine.module';
import { SubscriptionServiceModule } from '@services/subscriptions/subscription-service';
import { WhiteboardSavedResolverSubscription } from './whiteboard.saved.resolver.subscription';

@Module({
imports: [
Expand All @@ -29,14 +27,12 @@ import { WhiteboardSavedResolverSubscription } from './whiteboard.saved.resolver
StorageBucketModule,
TypeOrmModule.forFeature([Whiteboard]),
ProfileDocumentsModule,
SubscriptionServiceModule,
],
providers: [
WhiteboardService,
WhiteboardAuthorizationService,
WhiteboardResolverMutations,
WhiteboardResolverFields,
WhiteboardSavedResolverSubscription,
],
exports: [
WhiteboardService,
Expand Down
28 changes: 1 addition & 27 deletions src/domain/common/whiteboard/whiteboard.resolver.mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import { IWhiteboard } from './whiteboard.interface';
import { AuthorizationService } from '@core/authorization/authorization.service';
import { AuthorizationPrivilege } from '@common/enums/authorization.privilege';
import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston';
import {
UpdateWhiteboardContentInput,
UpdateWhiteboardEntityInput,
} from './types';
import { UpdateWhiteboardEntityInput } from './types';
import { DeleteWhiteboardInput } from './dto/whiteboard.dto.delete';
import { AuthorizationPolicyService } from '../authorization-policy/authorization.policy.service';
import { WhiteboardAuthorizationService } from './whiteboard.service.authorization';
Expand Down Expand Up @@ -102,29 +99,6 @@ export class WhiteboardResolverMutations {
);
}

@UseGuards(GraphqlGuard)
@Mutation(() => IWhiteboard, {
description: 'Updates the specified Whiteboard content.',
})
async updateWhiteboardContent(
@CurrentUser() agentInfo: AgentInfo,
@Args('whiteboardData') whiteboardData: UpdateWhiteboardContentInput
): Promise<IWhiteboard> {
const whiteboard = await this.whiteboardService.getWhiteboardOrFail(
whiteboardData.ID
);
this.authorizationService.grantAccessOrFail(
agentInfo,
whiteboard.authorization,
AuthorizationPrivilege.UPDATE_CONTENT,
`update content of Whiteboard: ${whiteboard.id}`
);
return this.whiteboardService.updateWhiteboardContent(
whiteboard,
whiteboardData
);
}

@UseGuards(GraphqlGuard)
@Mutation(() => IWhiteboard, {
description: 'Deletes the specified Whiteboard.',
Expand Down

This file was deleted.

Loading

0 comments on commit 2fccb25

Please sign in to comment.