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

Commit

Permalink
perf(deal/ticket/task): add attachment field
Browse files Browse the repository at this point in the history
  • Loading branch information
munkhjin0223 committed Jul 10, 2019
1 parent 5db66d8 commit df1420e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/data/schema/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const types = `
input AttachmentInput {
url: String!
name: String!
type: String!
type: String
size: Float
}
`;
Expand Down
2 changes: 2 additions & 0 deletions src/data/schema/deal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const types = `
modifiedAt: Date
modifiedBy: String
stage: Stage
attachments: [Attachment]
isWatched: Boolean
${commonTypes}
}
Expand Down Expand Up @@ -85,6 +86,7 @@ const commonParams = `
stageId: String,
assignedUserIds: [String],
companyIds: [String],
attachments: [AttachmentInput],
customerIds: [String],
closeDate: Date,
description: String,
Expand Down
2 changes: 2 additions & 0 deletions src/data/schema/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const types = `
customers: [Customer]
assignedUsers: [User]
isWatched: Boolean
attachments: [Attachment]
stage: Stage
pipeline: Pipeline
modifiedAt: Date
Expand Down Expand Up @@ -52,6 +53,7 @@ const commonParams = `
stageId: String,
assignedUserIds: [String],
companyIds: [String],
attachments: [AttachmentInput],
customerIds: [String],
closeDate: Date,
description: String,
Expand Down
2 changes: 2 additions & 0 deletions src/data/schema/ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const types = `
customers: [Customer]
assignedUsers: [User]
isWatched: Boolean
attachments: [Attachment]
stage: Stage
pipeline: Pipeline
modifiedAt: Date
Expand Down Expand Up @@ -54,6 +55,7 @@ const commonParams = `
stageId: String,
assignedUserIds: [String],
companyIds: [String],
attachments: [AttachmentInput],
customerIds: [String],
closeDate: Date,
description: String,
Expand Down
12 changes: 12 additions & 0 deletions src/db/models/definitions/boards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface IItemCommonFields {
assignedUserIds?: string[];
watchedUserIds?: string[];
notifiedUserIds?: string[];
attachments?: any[];
stageId?: string;
initialStageId?: string;
modifiedAt?: Date;
Expand Down Expand Up @@ -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 }),
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit df1420e

Please sign in to comment.