Skip to content

Commit

Permalink
Merge pull request #539 from teambition/feat/task-creator
Browse files Browse the repository at this point in the history
feat(schemas/Task): 补充已在使用中的 `creator` 字段
  • Loading branch information
chuan6 authored Sep 4, 2018
2 parents a3e2978 + a62b57b commit c31da99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/schemas/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface TaskSchema {
isArchived: boolean
isDeleted: boolean
created: string
creator?: ExecutorOrCreator
updated: string
visible: VisibleOption
_organizationId: OrganizationId | null
Expand Down Expand Up @@ -145,6 +146,15 @@ const schema: SchemaDef<TaskSchema> = {
created: {
type: RDBType.DATE_TIME
},
creator: {
type: Relationship.oneToOne,
virtual: {
name: 'User',
where: (userTable: any) => ({
_creatorId: userTable._id
})
}
},
customfields: {
type: RDBType.OBJECT
},
Expand Down
1 change: 1 addition & 0 deletions test/apis/task.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ describe('TaskApi socket spec', () => {
yield sdk.database.get<TaskSchema>('Task', { where: { _id: fixture._id } })
.values()
.do(([r]) => {
delete r.creator
delete r.project
looseDeepEqual(r, fixture)
})
Expand Down

0 comments on commit c31da99

Please sign in to comment.