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(schemas/AdvancedCustomField): 新增高级自定义字段相关类型 #493

Merged
merged 1 commit into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
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
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.LITERAL_ARRAY
},
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 @@ -3,6 +3,7 @@
declare module 'teambition-types' {
export interface ActivenessId extends String { kind?: 'ActivenessId' }
export interface ActivityId extends String { kind?: 'ActivityId' }
export interface AdvancedCustomFieldId extends String { kind?: 'AdvancedCustomFieldId' }
export interface ApplicationId extends String { kind?: 'ApplicationId' }
export interface CollectionId extends String { kind?: 'CollectionId' }
export interface CustomFieldCategoryId extends String { kind?: 'CustomFieldCategoryId' }
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