forked from twentyhq/twenty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom field types on seed (twentyhq#6505)
Fixes twentyhq#6364 --------- Co-authored-by: Weiko <[email protected]>
- Loading branch information
1 parent
ed0102e
commit 48f4e41
Showing
5 changed files
with
292 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
174 changes: 174 additions & 0 deletions
174
packages/twenty-server/src/database/typeorm-seeds/metadata/fieldsMetadata.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
import { CreateFieldInput } from 'src/engine/metadata-modules/field-metadata/dtos/create-field.input'; | ||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity'; | ||
|
||
export const getDevSeedCompanyCustomFields = ( | ||
objectMetadataId: string, | ||
workspaceId: string, | ||
): CreateFieldInput[] => { | ||
return [ | ||
{ | ||
workspaceId, | ||
type: FieldMetadataType.TEXT, | ||
name: 'tagline', | ||
label: 'Tagline', | ||
description: "Company's Tagline", | ||
icon: 'IconAdCircle', | ||
isActive: true, | ||
isNullable: false, | ||
objectMetadataId, | ||
}, | ||
{ | ||
workspaceId, | ||
type: FieldMetadataType.LINKS, | ||
name: 'introVideo', | ||
label: 'Intro Video', | ||
description: "Company's Intro Video", | ||
icon: 'IconVideo', | ||
isActive: true, | ||
isNullable: true, | ||
objectMetadataId, | ||
}, | ||
{ | ||
workspaceId, | ||
type: FieldMetadataType.MULTI_SELECT, | ||
name: 'workPolicy', | ||
label: 'Work Policy', | ||
description: "Company's Work Policy", | ||
icon: 'IconHome', | ||
isActive: true, | ||
isNullable: true, | ||
objectMetadataId, | ||
options: [ | ||
{ | ||
color: 'green', | ||
label: 'On-Site', | ||
position: 0, | ||
value: 'ON_SITE', | ||
}, | ||
{ | ||
color: 'turquoise', | ||
label: 'Hybrid', | ||
position: 1, | ||
value: 'HYBRID', | ||
}, | ||
{ | ||
color: 'sky', | ||
label: 'Remote Work', | ||
position: 2, | ||
value: 'REMOTE_WORK', | ||
}, | ||
], | ||
}, | ||
{ | ||
workspaceId, | ||
type: FieldMetadataType.BOOLEAN, | ||
name: 'visaSponsorship', | ||
label: 'Visa Sponsorship', | ||
description: "Company's Visa Sponsorship Policy", | ||
icon: 'IconBrandVisa', | ||
isActive: true, | ||
isNullable: true, | ||
objectMetadataId, | ||
defaultValue: false, | ||
}, | ||
]; | ||
}; | ||
|
||
export const getDevSeedPeopleCustomFields = ( | ||
objectMetadataId: string, | ||
workspaceId: string, | ||
): CreateFieldInput[] => { | ||
return [ | ||
{ | ||
workspaceId, | ||
type: FieldMetadataType.TEXT, | ||
name: 'intro', | ||
label: 'Intro', | ||
description: "Contact's Intro", | ||
icon: 'IconNote', | ||
isActive: true, | ||
isNullable: true, | ||
objectMetadataId, | ||
}, | ||
{ | ||
workspaceId, | ||
type: FieldMetadataType.PHONE, | ||
name: 'whatsapp', | ||
label: 'Whatsapp', | ||
description: "Contact's Whatsapp Number", | ||
icon: 'IconBrandWhatsapp', | ||
isActive: true, | ||
isNullable: false, | ||
objectMetadataId, | ||
}, | ||
{ | ||
workspaceId, | ||
type: FieldMetadataType.MULTI_SELECT, | ||
name: 'workPrefereance', | ||
label: 'Work Preference', | ||
description: "Person's Work Preference", | ||
icon: 'IconHome', | ||
isActive: true, | ||
isNullable: true, | ||
objectMetadataId, | ||
options: [ | ||
{ | ||
color: 'green', | ||
label: 'On-Site', | ||
position: 0, | ||
value: 'ON_SITE', | ||
}, | ||
{ | ||
color: 'turquoise', | ||
label: 'Hybrid', | ||
position: 1, | ||
value: 'HYBRID', | ||
}, | ||
{ | ||
color: 'sky', | ||
label: 'Remote Work', | ||
position: 2, | ||
value: 'REMOTE_WORK', | ||
}, | ||
], | ||
}, | ||
{ | ||
workspaceId, | ||
type: FieldMetadataType.RATING, | ||
name: 'performanceRating', | ||
label: 'Performance Rating', | ||
description: "Person's Performance Rating", | ||
icon: 'IconStars', | ||
isActive: true, | ||
isNullable: true, | ||
objectMetadataId, | ||
options: [ | ||
{ | ||
label: '1', | ||
value: 'RATING_1', | ||
position: 0, | ||
}, | ||
{ | ||
label: '2', | ||
value: 'RATING_2', | ||
position: 1, | ||
}, | ||
{ | ||
label: '3', | ||
value: 'RATING_3', | ||
position: 2, | ||
}, | ||
{ | ||
label: '4', | ||
value: 'RATING_4', | ||
position: 3, | ||
}, | ||
{ | ||
label: '5', | ||
value: 'RATING_5', | ||
position: 4, | ||
}, | ||
], | ||
}, | ||
]; | ||
}; |
Oops, something went wrong.