♻️Removed unused websockets

This commit is contained in:
Anton SHEPILOV
2024-05-24 00:19:31 +02:00
parent 757a4759f8
commit 6f0bfbcd09
51 changed files with 7 additions and 1620 deletions
@@ -53,13 +53,8 @@ import {
makeStandaloneAccessLevel,
getItemScope,
} from "./access-check";
import { websocketEventBus } from "../../../core/platform/services/realtime/bus";
import archiver from "archiver";
import internal from "stream";
import {
RealtimeEntityActionType,
ResourcePath,
} from "../../../core/platform/services/realtime/types";
import config from "config";
export class DocumentsService {
version: "1";
@@ -410,9 +405,6 @@ export class DocumentsService {
//TODO[ASH] update item size only for files, there is not need to do during direcotry creation
await updateItemSize(driveItem.parent_id, this.repository, context);
//TODO[ASH] there is no need to notify websocket, until we implement user notification
await this.notifyWebsocket(driveItem.parent_id, context);
await globalResolver.platformServices.messageQueue.publish<DocumentsMessageQueueRequest>(
"services:documents:process",
{
@@ -681,11 +673,7 @@ export class DocumentsService {
await this.update(item.id, item, context);
}
await updateItemSize(previousParentId, this.repository, context);
await this.notifyWebsocket(previousParentId, context);
}
await this.notifyWebsocket("trash", context);
};
/**
@@ -963,19 +951,6 @@ export class DocumentsService {
return archive;
};
notifyWebsocket = async (id: string, context: DriveExecutionContext) => {
websocketEventBus.publish(RealtimeEntityActionType.Event, {
type: "documents:updated",
room: ResourcePath.get(`/companies/${context.company.id}/documents/item/${id}`),
entity: {
companyId: context.company.id,
id: id,
},
resourcePath: null,
result: null,
});
};
/**
* Search for Drive items.
*
@@ -5,11 +5,7 @@ import { CrudException, ListResult } from "../../../../core/platform/framework/a
import { File } from "../../../../services/files/entities/file";
import { UploadOptions } from "../../../../services/files/types";
import globalResolver from "../../../../services/global-resolver";
import {
CompanyUserRole,
PaginationQueryParameters,
ResourceWebsocket,
} from "../../../../utils/types";
import { CompanyUserRole, PaginationQueryParameters } from "../../../../utils/types";
import { DriveFile } from "../../entities/drive-file";
import { FileVersion } from "../../entities/file-version";
import {
@@ -160,18 +156,12 @@ export class DocumentsController {
Params: ItemRequestParams;
Querystring: PaginationQueryParameters & { public_token?: string };
}>,
): Promise<DriveItemDetails & { websockets: ResourceWebsocket[] }> => {
): Promise<DriveItemDetails> => {
const context = getDriveExecutionContext(request);
const { id } = request.params;
return {
...(await globalResolver.services.documents.documents.get(id, context)),
websockets: request.currentUser?.id
? globalResolver.platformServices.realtime.sign(
[{ room: `/companies/${context.company.id}/documents/item/${id}` }],
request.currentUser?.id,
)
: [],
};
};
@@ -188,7 +178,7 @@ export class DocumentsController {
Body: SearchDocumentsBody;
Querystring: PaginationQueryParameters & { public_token?: string };
}>,
): Promise<DriveItemDetails & { websockets: ResourceWebsocket[] }> => {
): Promise<DriveItemDetails> => {
const context = getDriveExecutionContext(request);
const { id } = request.params;
@@ -202,7 +192,6 @@ export class DocumentsController {
return {
...(await globalResolver.services.documents.documents.browse(id, options, context)),
websockets: [],
};
};