From 80e4c8c29559cb26d225f7b113b1529f28735dfa Mon Sep 17 00:00:00 2001 From: WuHuiling Date: Thu, 14 Jun 2018 13:34:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(schemas/AdvancedCustomField):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=AB=98=E7=BA=A7=E8=87=AA=E5=AE=9A=E4=B9=89=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/schemas/CustomField.ts | 12 ++++++++++-- src/schemas/CustomFieldLink.ts | 16 ++++++++++++++-- src/teambition.ts | 21 ++++++++++++++++++++- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/src/schemas/CustomField.ts b/src/schemas/CustomField.ts index 706f67ffe..0b0920578 100644 --- a/src/schemas/CustomField.ts +++ b/src/schemas/CustomField.ts @@ -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[] @@ -28,6 +30,9 @@ const schema: SchemaDef = { type: RDBType.STRING, primaryKey: true }, + _advancedCustomfieldId: { + type: RDBType.STRING + }, _creatorId: { type: RDBType.STRING }, @@ -40,6 +45,9 @@ const schema: SchemaDef = { _roleIds: { type: RDBType.LITERAL_ARRAY }, + advancedCustomfield: { + type: RDBType.OBJECT + }, boundType: { type: RDBType.STRING }, diff --git a/src/schemas/CustomFieldLink.ts b/src/schemas/CustomFieldLink.ts index 3570d661a..68a5821d8 100644 --- a/src/schemas/CustomFieldLink.ts +++ b/src/schemas/CustomFieldLink.ts @@ -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' @@ -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 @@ -32,9 +35,18 @@ const schema: SchemaDef = { _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 }, diff --git a/src/teambition.ts b/src/teambition.ts index 67fd26b62..3c75e2173 100644 --- a/src/teambition.ts +++ b/src/teambition.ts @@ -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' } @@ -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' @@ -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[] }