Skip to content
This repository was archived by the owner on Nov 21, 2020. It is now read-only.

Commit df1420e

Browse files
committed
perf(deal/ticket/task): add attachment field
Closes erxes/erxes#1029
1 parent 5db66d8 commit df1420e

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

src/data/schema/conversation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const types = `
9595
input AttachmentInput {
9696
url: String!
9797
name: String!
98-
type: String!
98+
type: String
9999
size: Float
100100
}
101101
`;

src/data/schema/deal.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const types = `
2424
modifiedAt: Date
2525
modifiedBy: String
2626
stage: Stage
27+
attachments: [Attachment]
2728
isWatched: Boolean
2829
${commonTypes}
2930
}
@@ -85,6 +86,7 @@ const commonParams = `
8586
stageId: String,
8687
assignedUserIds: [String],
8788
companyIds: [String],
89+
attachments: [AttachmentInput],
8890
customerIds: [String],
8991
closeDate: Date,
9092
description: String,

src/data/schema/task.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const types = `
1919
customers: [Customer]
2020
assignedUsers: [User]
2121
isWatched: Boolean
22+
attachments: [Attachment]
2223
stage: Stage
2324
pipeline: Pipeline
2425
modifiedAt: Date
@@ -52,6 +53,7 @@ const commonParams = `
5253
stageId: String,
5354
assignedUserIds: [String],
5455
companyIds: [String],
56+
attachments: [AttachmentInput],
5557
customerIds: [String],
5658
closeDate: Date,
5759
description: String,

src/data/schema/ticket.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const types = `
2020
customers: [Customer]
2121
assignedUsers: [User]
2222
isWatched: Boolean
23+
attachments: [Attachment]
2324
stage: Stage
2425
pipeline: Pipeline
2526
modifiedAt: Date
@@ -54,6 +55,7 @@ const commonParams = `
5455
stageId: String,
5556
assignedUserIds: [String],
5657
companyIds: [String],
58+
attachments: [AttachmentInput],
5759
customerIds: [String],
5860
closeDate: Date,
5961
description: String,

src/db/models/definitions/boards.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface IItemCommonFields {
1818
assignedUserIds?: string[];
1919
watchedUserIds?: string[];
2020
notifiedUserIds?: string[];
21+
attachments?: any[];
2122
stageId?: string;
2223
initialStageId?: string;
2324
modifiedAt?: Date;
@@ -64,6 +65,16 @@ export interface IOrderInput {
6465
order: number;
6566
}
6667

68+
const attachmentSchema = new Schema(
69+
{
70+
name: field({ type: String }),
71+
url: field({ type: String }),
72+
type: field({ type: String }),
73+
size: field({ type: Number, optional: true }),
74+
},
75+
{ _id: false },
76+
);
77+
6778
// Mongoose schemas =======================
6879
const commonFieldsSchema = {
6980
userId: field({ type: String }),
@@ -94,6 +105,7 @@ export const commonItemFieldsSchema = {
94105
description: field({ type: String, optional: true }),
95106
assignedUserIds: field({ type: [String] }),
96107
watchedUserIds: field({ type: [String] }),
108+
attachments: field({ type: [attachmentSchema] }),
97109
stageId: field({ type: String, optional: true }),
98110
initialStageId: field({ type: String, optional: true }),
99111
modifiedAt: field({

0 commit comments

Comments
 (0)