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[] }