This repository has been archived by the owner on Jan 13, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(deal/ticket/task): Add watch option for deal, ticket, task and p…
…ipeline Closes erxes/erxes#1013
- Loading branch information
1 parent
416fe74
commit 1956ec1
Showing
4 changed files
with
59 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,18 @@ | ||
import { Document, Schema } from 'mongoose'; | ||
import { field } from '../utils'; | ||
import { commonItemFieldsSchema, IItemCommonFields } from './boards'; | ||
|
||
interface ICommonFields { | ||
userId?: string; | ||
createdAt?: Date; | ||
order?: number; | ||
} | ||
|
||
export interface ITask extends ICommonFields { | ||
name?: string; | ||
companyIds?: string[]; | ||
customerIds?: string[]; | ||
closeDate?: Date; | ||
description?: string; | ||
assignedUserIds?: string[]; | ||
stageId?: string; | ||
export interface ITask extends IItemCommonFields { | ||
priority?: string; | ||
modifiedAt?: Date; | ||
modifiedBy?: string; | ||
} | ||
|
||
export interface ITaskDocument extends ITask, ICommonFields, Document { | ||
export interface ITaskDocument extends ITask, Document { | ||
_id: string; | ||
} | ||
|
||
// Mongoose schemas ======================= | ||
const commonFieldsSchema = { | ||
userId: field({ type: String }), | ||
createdAt: field({ | ||
type: Date, | ||
default: new Date(), | ||
}), | ||
order: field({ type: Number }), | ||
}; | ||
|
||
export const taskSchema = new Schema({ | ||
_id: field({ pkey: true }), | ||
name: field({ type: String }), | ||
companyIds: field({ type: [String] }), | ||
customerIds: field({ type: [String] }), | ||
closeDate: field({ type: Date }), | ||
description: field({ type: String, optional: true }), | ||
assignedUserIds: field({ type: [String] }), | ||
stageId: field({ type: String, optional: true }), | ||
...commonItemFieldsSchema, | ||
|
||
priority: field({ type: String, optional: true }), | ||
modifiedAt: field({ | ||
type: Date, | ||
default: new Date(), | ||
}), | ||
modifiedBy: field({ type: String }), | ||
...commonFieldsSchema, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,20 @@ | ||
import { Document, Schema } from 'mongoose'; | ||
import { field } from '../utils'; | ||
import { commonItemFieldsSchema, IItemCommonFields } from './boards'; | ||
|
||
interface ICommonFields { | ||
userId?: string; | ||
createdAt?: Date; | ||
order?: number; | ||
} | ||
|
||
export interface ITicket extends ICommonFields { | ||
name?: string; | ||
companyIds?: string[]; | ||
customerIds?: string[]; | ||
closeDate?: Date; | ||
description?: string; | ||
export interface ITicket extends IItemCommonFields { | ||
priority?: string; | ||
source?: string; | ||
assignedUserIds?: string[]; | ||
stageId?: string; | ||
modifiedAt?: Date; | ||
modifiedBy?: string; | ||
} | ||
|
||
export interface ITicketDocument extends ITicket, ICommonFields, Document { | ||
export interface ITicketDocument extends ITicket, Document { | ||
_id: string; | ||
} | ||
|
||
// Mongoose schemas ======================= | ||
const commonFieldsSchema = { | ||
userId: field({ type: String }), | ||
createdAt: field({ | ||
type: Date, | ||
default: new Date(), | ||
}), | ||
order: field({ type: Number }), | ||
}; | ||
|
||
export const ticketSchema = new Schema({ | ||
_id: field({ pkey: true }), | ||
name: field({ type: String }), | ||
companyIds: field({ type: [String] }), | ||
customerIds: field({ type: [String] }), | ||
closeDate: field({ type: Date }), | ||
description: field({ type: String, optional: true }), | ||
assignedUserIds: field({ type: [String] }), | ||
stageId: field({ type: String, optional: true }), | ||
modifiedAt: field({ | ||
type: Date, | ||
default: new Date(), | ||
}), | ||
modifiedBy: field({ type: String }), | ||
...commonItemFieldsSchema, | ||
|
||
priority: field({ type: String }), | ||
source: field({ type: String }), | ||
...commonFieldsSchema, | ||
}); |