From b57e4693c54356689c7853346a7fe3c818f4bc80 Mon Sep 17 00:00:00 2001 From: Mohamed Marrouchi Date: Thu, 9 Jan 2025 17:02:31 +0100 Subject: [PATCH] refactor: remove unecessary type --- api/src/chat/schemas/types/attachment.ts | 5 ----- api/src/chat/schemas/types/message.ts | 10 ++++------ api/src/chat/schemas/types/quick-reply.ts | 6 +++--- frontend/src/types/message.types.ts | 14 ++++---------- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/api/src/chat/schemas/types/attachment.ts b/api/src/chat/schemas/types/attachment.ts index 830e55ed..e5e0eaf2 100644 --- a/api/src/chat/schemas/types/attachment.ts +++ b/api/src/chat/schemas/types/attachment.ts @@ -28,8 +28,3 @@ export interface AttachmentPayload< type: FileType; payload: A; } - -export interface IncomingAttachmentPayload { - type: FileType; - payload: AttachmentForeignKey; -} diff --git a/api/src/chat/schemas/types/message.ts b/api/src/chat/schemas/types/message.ts index 78b9fc1c..dbe53b05 100644 --- a/api/src/chat/schemas/types/message.ts +++ b/api/src/chat/schemas/types/message.ts @@ -11,11 +11,7 @@ import { PluginName } from '@/plugins/types'; import { Message } from '../message.schema'; -import { - AttachmentForeignKey, - AttachmentPayload, - IncomingAttachmentPayload, -} from './attachment'; +import { AttachmentForeignKey, AttachmentPayload } from './attachment'; import { Button } from './button'; import { ContentOptions } from './options'; import { StdQuickReply } from './quick-reply'; @@ -146,7 +142,9 @@ export type StdIncomingLocationMessage = { export type StdIncomingAttachmentMessage = { type: PayloadType.attachments; serialized_text: string; - attachment: IncomingAttachmentPayload | IncomingAttachmentPayload[]; + attachment: + | AttachmentPayload + | AttachmentPayload[]; }; export type StdIncomingMessage = diff --git a/api/src/chat/schemas/types/quick-reply.ts b/api/src/chat/schemas/types/quick-reply.ts index df47e1a3..f1e2c541 100644 --- a/api/src/chat/schemas/types/quick-reply.ts +++ b/api/src/chat/schemas/types/quick-reply.ts @@ -1,12 +1,12 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ -import { IncomingAttachmentPayload } from './attachment'; +import { AttachmentForeignKey, AttachmentPayload } from './attachment'; import { PayloadType } from './message'; export type Payload = @@ -19,7 +19,7 @@ export type Payload = } | { type: PayloadType.attachments; - attachments: IncomingAttachmentPayload; + attachments: AttachmentPayload; }; export enum QuickReplyType { diff --git a/frontend/src/types/message.types.ts b/frontend/src/types/message.types.ts index 3c386de3..b1433934 100644 --- a/frontend/src/types/message.types.ts +++ b/frontend/src/types/message.types.ts @@ -63,15 +63,7 @@ export interface AttachmentPayload< payload?: A; } -export interface IncomingAttachmentPayload { - type: FileType; - payload: { - url: string; - }; -} - // Content - export interface ContentOptions { display: OutgoingMessageFormat.list | OutgoingMessageFormat.carousel; fields: { @@ -104,7 +96,7 @@ export type Payload = } | { type: PayloadType.attachments; - attachments: IncomingAttachmentPayload; + attachments: AttachmentPayload; }; export enum QuickReplyType { @@ -198,7 +190,9 @@ export type StdIncomingLocationMessage = { export type StdIncomingAttachmentMessage = { type: PayloadType.attachments; serialized_text: string; - attachment: IncomingAttachmentPayload | IncomingAttachmentPayload[]; + attachment: + | AttachmentPayload + | AttachmentPayload[]; }; export type StdPluginMessage = {