Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(TaskflowSchema): 增加 taskflowstatuses 字段 #510

Merged
merged 1 commit into from
Aug 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions src/schemas/Taskflow.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { SchemaDef, RDBType } from 'reactivedb/interface'
import { SchemaDef, RDBType, Relationship } from 'reactivedb/interface'
import { schemaColl } from './schemas'
import { TaskflowId, UserId } from 'teambition-types'
import { TaskflowId, UserId, ProjectId, OrganizationId } from 'teambition-types'
import { TaskflowStatusSnippet } from './TaskflowStatus'

export interface TaskflowSchema {
_id: TaskflowId
name: string
_boundToObjectId: string
boundToObjectType: 'project' | 'organization'
_boundToObjectId: ProjectId | OrganizationId
_creatorId: UserId
boundToObjectType: 'project' | 'organization'
created: string
name: string
taskflowstatuses?: TaskflowStatusSnippet[]
updated: string
}

Expand All @@ -32,9 +34,18 @@ const schema: SchemaDef<TaskflowSchema> = {
name: {
type: RDBType.STRING
},
taskflowstatuses: {
type: Relationship.oneToMany,
virtual: {
name: 'TaskflowStatus',
where: (taskflowStatusTable: any) => ({
_id: taskflowStatusTable._taskflowId
})
}
},
updated: {
type: RDBType.DATE_TIME
}
},
}

schemaColl.add({ schema, name: 'Taskflow' })