Skip to content

Commit

Permalink
🛠 Fix canary breaking changes (#2179)
Browse files Browse the repository at this point in the history
* Fix canary before release

* 🛠 Fix deps (#2126)
  • Loading branch information
RomaricMourgues authored May 20, 2022
1 parent ea56e53 commit 95466ca
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 12 deletions.
6 changes: 5 additions & 1 deletion twake/backend/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@types/config": "0.0.36",
"@types/eslint": "^7.2.3",
"@types/fastify-multipart": "^0.7.0",
"@types/fastify-static": "^2.2.1",
"@types/jest": "^26.0.14",
"@types/lodash": "^4.14.165",
"@types/minio": "^7.0.7",
Expand Down Expand Up @@ -97,6 +98,8 @@
},
"dependencies": {
"@elastic/elasticsearch": "7",
"@fastify/formbody": "^6.0.0",
"@fastify/static": "^5.0.1",
"@sentry/node": "^6.15.0",
"@sentry/tracing": "^6.15.0",
"@socket.io/redis-adapter": "^7.1.0",
Expand All @@ -120,8 +123,9 @@
"fastify-jwt": "^2.2.0",
"fastify-multipart": "5.3.1",
"fastify-plugin": "^2.3.4",
"fastify-sensible": "^3.0.1",
"fastify-sensible": "=3.0.1",
"fastify-socket.io": "^3.0.0",
"fastify-static": "^4.7.0",
"fastify-swagger": "^4.12.6",
"fastify-websocket": "^2.0.11",
"find-my-way": "^5.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Server, IncomingMessage, ServerResponse } from "http";
import { FastifyInstance, fastify } from "fastify";
import sensible from "fastify-sensible";
import multipart from "fastify-multipart";
import formbody from "fastify-formbody";
import fastifyStatic from "fastify-static";
import formbody from "@fastify/formbody";
import fastifyStatic from "@fastify/static";
import corsPlugin, { FastifyCorsOptions } from "fastify-cors";
import { serverErrorHandler } from "./error";
import WebServerAPI from "./provider";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { NewPendingEmailsInWorkspaceJoinChannelsProcessor } from "./new-pending-
import { NewWorkspaceProcessor } from "./new-workspace";
import gr from "../../../global-resolver";

export class PubsubListener implements Initializable {
export class ChannelsPubsubListener implements Initializable {
async init(): Promise<this> {
const channelActivityProcessor = await new NewChannelActivityProcessor().init();
gr.platformServices.pubsub.processor.addHandler(channelActivityProcessor);
Expand Down
3 changes: 3 additions & 0 deletions twake/backend/node/src/services/global-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import { ApplicationHooksService } from "./applications/services/hooks";
import { OnlineServiceAPI } from "./online/api";
import OnlineServiceImpl from "./online/service";
import { PreviewEngine } from "./previews/services/engine";
import { ChannelsPubsubListener } from "./channels/services/pubsub";

type PlatformServices = {
auth: AuthServiceAPI;
Expand Down Expand Up @@ -120,6 +121,7 @@ type TwakeServices = {
channels: {
channels: ChannelService;
members: MemberService;
pubsub: ChannelsPubsubListener;
};
channelPendingEmail: ChannelPendingEmailService;
tab: TabService;
Expand Down Expand Up @@ -196,6 +198,7 @@ class GlobalResolver {
channels: {
channels: await new ChannelServiceImpl().init(),
members: await new MemberServiceImpl().init(),
pubsub: await new ChannelsPubsubListener().init(),
},
channelPendingEmail: await new ChannelPendingEmailServiceImpl().init(),
tab: await new TabServiceImpl().init(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Column, Entity } from "../../../core/platform/services/database/service

export const TYPE = "message_file_refs";
@Entity(TYPE, {
primaryKey: [["target_type", "target_id"], "id"],
primaryKey: [["target_type", "company_id", "target_id"], "id"],
type: TYPE,
})
export class MessageFileRef {
Expand Down Expand Up @@ -41,8 +41,11 @@ export class MessageFileRef {
message_id: string;

@Type(() => String)
@Column("file_id", "string")
file_id: string;
@Column("message_file_id", "string")
message_file_id: string;

@Column("company_id", "timeuuid")
company_id: string;
}

export type MessageFileRefPrimaryKey = Pick<MessageFileRef, "target_type" | "target_id" | "id">;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Thread } from "../../../../entities/threads";
import Repository from "../../../../../../core/platform/services/database/services/orm/repository/repository";
import { getInstance, MessageFileRef } from "../../../../entities/message-file-refs";
import gr from "../../../../../global-resolver";
import uuid from "node-uuid";

export class FilesViewProcessor {
repository: Repository<MessageFileRef>;
Expand All @@ -22,13 +23,14 @@ export class FilesViewProcessor {
const fileRef = getInstance({
target_type: "channel",
target_id: participant.id,
id: file.id,
id: uuid.v1(),
created_at: message.resource.created_at,
workspace_id: participant.workspace_id,
channel_id: participant.id,
thread_id: thread.id,
message_id: message.resource.id,
file_id: file.id,
message_file_id: file.id,
company_id: file.company_id,
});
this.repository.save(fileRef);
}
Expand All @@ -37,13 +39,14 @@ export class FilesViewProcessor {
const fileRef = getInstance({
target_type: "user_upload",
target_id: message.resource.user_id,
id: file.id,
id: uuid.v1(),
created_at: message.resource.created_at,
workspace_id: "",
channel_id: "",
thread_id: thread.id,
message_id: message.resource.id,
file_id: file.id,
message_file_id: file.id,
company_id: file.company_id,
});
this.repository.save(fileRef);
}
Expand Down
6 changes: 5 additions & 1 deletion twake/backend/node/src/services/messages/services/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ export class ViewsServiceImpl implements MessageViewsServiceAPI {
context?: ChannelViewExecutionContext,
): Promise<ListResult<MessageWithReplies | FlatFileFromMessage>> {
const refs = await this.repositoryFilesRef.find(
{ target_type: "channel", target_id: context.channel.id },
{
target_type: "channel",
target_id: context.channel.id,
company_id: context.channel.company_id,
},
buildMessageListPagination(pagination, "id"),
);

Expand Down

0 comments on commit 95466ca

Please sign in to comment.