Skip to content

Commit

Permalink
feat(schemas/AdvancedCustomField)
Browse files Browse the repository at this point in the history
  • Loading branch information
WuHuiling committed Jun 20, 2018
1 parent 67d1fcc commit 378cb9e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
12 changes: 10 additions & 2 deletions src/schemas/CustomField.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { SchemaDef, RDBType } from 'reactivedb/interface'
import { schemaColl } from './schemas'
import { CustomFieldType, CustomFieldBoundType, CustomFieldCategoryId } from 'teambition-types'
import { CustomFieldId, OrganizationId, ProjectId, RoleId, UserId } from 'teambition-types'
import { CustomFieldType, CustomFieldBoundType, CustomFieldCategoryId, AdvancedCustomField } from 'teambition-types'
import { CustomFieldId, OrganizationId, ProjectId, RoleId, UserId, AdvancedCustomFieldId } from 'teambition-types'

import { CustomFieldChoiceSchema } from './CustomFieldChoice'

export interface CustomFieldSchema {
_advancedCustomfieldId: AdvancedCustomFieldId
_creatorId: UserId
_id: CustomFieldId
_organizationId: OrganizationId
_projectId?: ProjectId
_roleIds: RoleId[]
advancedCustomfield: AdvancedCustomField
boundType: CustomFieldBoundType
categoryIds: CustomFieldCategoryId[]
choices: CustomFieldChoiceSchema[]
Expand All @@ -28,6 +30,9 @@ const schema: SchemaDef<CustomFieldSchema> = {
type: RDBType.STRING,
primaryKey: true
},
_advancedCustomfieldId: {
type: RDBType.STRING
},
_creatorId: {
type: RDBType.STRING
},
Expand All @@ -40,6 +45,9 @@ const schema: SchemaDef<CustomFieldSchema> = {
_roleIds: {
type: RDBType.LITERAL_ARRAY
},
advancedCustomfield: {
type: RDBType.OBJECT
},
boundType: {
type: RDBType.STRING
},
Expand Down
16 changes: 14 additions & 2 deletions src/schemas/CustomFieldLink.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchemaDef, RDBType } from 'reactivedb/interface'
import { schemaColl } from './schemas'
import { CustomFieldType, CustomFieldBoundType } from 'teambition-types'
import { CustomFieldId, CustomFieldLinkId, ProjectId, RoleId } from 'teambition-types'
import { CustomFieldType, CustomFieldBoundType, AdvancedCustomField } from 'teambition-types'
import { CustomFieldId, CustomFieldLinkId, ProjectId, RoleId, CustomFieldCategoryId } from 'teambition-types'

import { CustomFieldChoiceSchema } from './CustomFieldChoice'

Expand All @@ -10,8 +10,11 @@ export interface CustomFieldLinkSchema {
_id: CustomFieldLinkId
_projectId: ProjectId
_roleIds: RoleId[]
advancedCustomfield: AdvancedCustomField | null
boundType: CustomFieldBoundType
categoryIds: CustomFieldCategoryId[]
choices: CustomFieldChoiceSchema[]
description: string
displayed: boolean
name: string
pos: number
Expand All @@ -32,9 +35,18 @@ const schema: SchemaDef<CustomFieldLinkSchema> = {
_roleIds: {
type: RDBType.LITERAL_ARRAY
},
advancedCustomfield: {
type: RDBType.OBJECT
},
description: {
type: RDBType.STRING
},
boundType: {
type: RDBType.STRING
},
categoryIds: {
type: RDBType.OBJECT
},
choices: {
type: RDBType.OBJECT
},
Expand Down
21 changes: 20 additions & 1 deletion src/teambition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare module 'teambition-types' {
export interface ActivityId extends String { kind?: 'ActivityId' }
export interface ApplicationId extends String { kind?: 'ApplicationId' }
export interface CollectionId extends String { kind?: 'CollectionId' }
export interface AdvancedCustomFieldId extends String { kind?: 'AdvancedCustomFieldId' }
export interface CustomFieldCategoryId extends String { kind?: 'CustomFieldCategoryId' }
export interface CustomFieldChoiceId extends String { kind?: 'CustomFieldChoiceId' }
export interface CustomFieldId extends String { kind?: 'CustomFieldId' }
Expand Down Expand Up @@ -61,7 +62,7 @@ declare module 'teambition-types' {

declare module 'teambition-types' {
export type CustomFieldBoundType = 'member' | 'project' | 'application'
export type CustomFieldType = 'date' | 'dropDown' | 'multipleChoice' | 'number' | 'text'
export type CustomFieldType = 'date' | 'dropDown' | 'multipleChoice' | 'number' | 'text' | 'lookup'
export type CustomRoleType = 'project' | 'organization'
export type CustomScenarioFieldType = 'customfield'
export type DefaultColors = 'gray' | 'red' | 'yellow' | 'green' | 'blue' | 'purple'
Expand All @@ -88,9 +89,27 @@ declare module 'teambition-types' {

declare module 'teambition-types' {

export interface AdvancedCustomField {
_id: AdvancedCustomFieldId
icon: string
hasCreateUrl: boolean
name: string
objectType: string
type: CustomFieldType
}

export interface AdvancedCustomFieldValue {
_id: string
description: string
thumbUrl: string
title: string
url: string
}

export interface CustomFieldValue {
_customfieldId: CustomFieldId
type: CustomFieldType
value: {}
values: string[]
}

Expand Down

0 comments on commit 378cb9e

Please sign in to comment.