diff --git a/src/data/schema/conversation.ts b/src/data/schema/conversation.ts index 9957d2366..71e9f39ce 100644 --- a/src/data/schema/conversation.ts +++ b/src/data/schema/conversation.ts @@ -95,7 +95,7 @@ export const types = ` input AttachmentInput { url: String! name: String! - type: String! + type: String size: Float } `; diff --git a/src/data/schema/deal.ts b/src/data/schema/deal.ts index b5d4c04a9..09d61c9b2 100644 --- a/src/data/schema/deal.ts +++ b/src/data/schema/deal.ts @@ -24,6 +24,7 @@ export const types = ` modifiedAt: Date modifiedBy: String stage: Stage + attachments: [Attachment] isWatched: Boolean ${commonTypes} } @@ -85,6 +86,7 @@ const commonParams = ` stageId: String, assignedUserIds: [String], companyIds: [String], + attachments: [AttachmentInput], customerIds: [String], closeDate: Date, description: String, diff --git a/src/data/schema/task.ts b/src/data/schema/task.ts index 05bd4443f..56aeebc4a 100644 --- a/src/data/schema/task.ts +++ b/src/data/schema/task.ts @@ -19,6 +19,7 @@ export const types = ` customers: [Customer] assignedUsers: [User] isWatched: Boolean + attachments: [Attachment] stage: Stage pipeline: Pipeline modifiedAt: Date @@ -52,6 +53,7 @@ const commonParams = ` stageId: String, assignedUserIds: [String], companyIds: [String], + attachments: [AttachmentInput], customerIds: [String], closeDate: Date, description: String, diff --git a/src/data/schema/ticket.ts b/src/data/schema/ticket.ts index ea50f1453..53b038bd7 100644 --- a/src/data/schema/ticket.ts +++ b/src/data/schema/ticket.ts @@ -20,6 +20,7 @@ export const types = ` customers: [Customer] assignedUsers: [User] isWatched: Boolean + attachments: [Attachment] stage: Stage pipeline: Pipeline modifiedAt: Date @@ -54,6 +55,7 @@ const commonParams = ` stageId: String, assignedUserIds: [String], companyIds: [String], + attachments: [AttachmentInput], customerIds: [String], closeDate: Date, description: String, diff --git a/src/db/models/definitions/boards.ts b/src/db/models/definitions/boards.ts index be56d8428..a5d23fb20 100644 --- a/src/db/models/definitions/boards.ts +++ b/src/db/models/definitions/boards.ts @@ -18,6 +18,7 @@ export interface IItemCommonFields { assignedUserIds?: string[]; watchedUserIds?: string[]; notifiedUserIds?: string[]; + attachments?: any[]; stageId?: string; initialStageId?: string; modifiedAt?: Date; @@ -64,6 +65,16 @@ export interface IOrderInput { order: number; } +const attachmentSchema = new Schema( + { + name: field({ type: String }), + url: field({ type: String }), + type: field({ type: String }), + size: field({ type: Number, optional: true }), + }, + { _id: false }, +); + // Mongoose schemas ======================= const commonFieldsSchema = { userId: field({ type: String }), @@ -94,6 +105,7 @@ export const commonItemFieldsSchema = { description: field({ type: String, optional: true }), assignedUserIds: field({ type: [String] }), watchedUserIds: field({ type: [String] }), + attachments: field({ type: [attachmentSchema] }), stageId: field({ type: String, optional: true }), initialStageId: field({ type: String, optional: true }), modifiedAt: field({