Skip to content

Commit

Permalink
Update seed default values (twentyhq#2681)
Browse files Browse the repository at this point in the history
* Update seed default values

* Update seed default values

* Update seed default values

* remove allowImpersonation in workspaceMembers

* remove USD from currencyCode defaultValue

* fix tests
  • Loading branch information
Weiko authored Nov 23, 2023
1 parent a0478a0 commit 5038c36
Show file tree
Hide file tree
Showing 38 changed files with 90 additions and 86 deletions.
2 changes: 1 addition & 1 deletion server/src/core/auth/auth.resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('AuthResolver', () => {
providers: [
AuthResolver,
{
provide: getRepositoryToken(Workspace),
provide: getRepositoryToken(Workspace, 'core'),
useValue: {},
},
{
Expand Down
4 changes: 2 additions & 2 deletions server/src/core/auth/services/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ describe('AuthService', () => {
useValue: {},
},
{
provide: getRepositoryToken(Workspace),
provide: getRepositoryToken(Workspace, 'core'),
useValue: {},
},
{
provide: getRepositoryToken(User),
provide: getRepositoryToken(User, 'core'),
useValue: {},
},
],
Expand Down
4 changes: 2 additions & 2 deletions server/src/core/auth/services/token.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ describe('TokenService', () => {
useValue: {},
},
{
provide: getRepositoryToken(User),
provide: getRepositoryToken(User, 'core'),
useValue: {},
},
{
provide: getRepositoryToken(RefreshToken),
provide: getRepositoryToken(RefreshToken, 'core'),
useValue: {},
},
],
Expand Down
2 changes: 1 addition & 1 deletion server/src/core/user/services/user.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('UserService', () => {
providers: [
UserService,
{
provide: getRepositoryToken(User),
provide: getRepositoryToken(User, 'core'),
useValue: {},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('WorkspaceService', () => {
providers: [
WorkspaceService,
{
provide: getRepositoryToken(Workspace),
provide: getRepositoryToken(Workspace, 'core'),
useValue: {},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const seedActivityFieldMetadata = async (
icon: 'IconNotes',
isNullable: true,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: '' },
},

// Scalar fields
Expand All @@ -144,7 +144,7 @@ export const seedActivityFieldMetadata = async (
icon: 'IconList',
isNullable: true,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: '' },
},
{
id: SeedActivityFieldMetadataIds.Type,
Expand All @@ -162,7 +162,7 @@ export const seedActivityFieldMetadata = async (
icon: 'IconCheckbox',
isNullable: false,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: 'Note' },
},
{
id: SeedActivityFieldMetadataIds.ReminderAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const seedApiKeyFieldMetadata = async (
icon: 'IconLink',
isNullable: true,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: '' },
},
{
id: SeedApiKeyFieldMetadataIds.ExpiresAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const seedCompanyFieldMetadata = async (
icon: 'IconLink',
isNullable: true,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: '' },
},
{
id: SeedCompanyFieldMetadataIds.Address,
Expand All @@ -165,7 +165,7 @@ export const seedCompanyFieldMetadata = async (
icon: 'IconMap',
isNullable: true,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: '' },
},
{
id: SeedCompanyFieldMetadataIds.Employees,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ export const seedOpportunityFieldMetadata = async (
targetColumnMap: {
value: 'probability',
},
description: 'Opportunity amount',
description: 'Opportunity probability',
icon: 'IconProgressCheck',
isNullable: true,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: '0' },
},
// Relationships
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export const seedPersonFieldMetadata = async (
icon: 'IconBriefcase',
isNullable: true,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: '' },
},
{
id: SeedPersonFieldMetadataIds.Phone,
Expand All @@ -222,7 +222,7 @@ export const seedPersonFieldMetadata = async (
icon: 'IconPhone',
isNullable: true,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: '' },
},
{
id: SeedPersonFieldMetadataIds.City,
Expand All @@ -240,7 +240,7 @@ export const seedPersonFieldMetadata = async (
icon: 'IconMap',
isNullable: true,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: '' },
},
{
id: SeedPersonFieldMetadataIds.AvatarUrl,
Expand All @@ -258,7 +258,7 @@ export const seedPersonFieldMetadata = async (
icon: 'IconFileUpload',
isNullable: true,
isSystem: true,
defaultValue: undefined,
defaultValue: { value: '' },
},

// Relationships
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const seedViewFieldFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.TEXT,
type: FieldMetadataType.UUID,
name: 'fieldMetadataId',
label: 'Field Metadata Id',
targetColumnMap: {
Expand All @@ -116,7 +116,7 @@ export const seedViewFieldFieldMetadata = async (
icon: 'IconTag',
isNullable: false,
isSystem: false,
defaultValue: { value: '' },
defaultValue: undefined,
},
{
id: SeedViewFieldFieldMetadataIds.View,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const seedViewFilterFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.TEXT,
type: FieldMetadataType.UUID,
name: 'fieldMetadataId',
label: 'Field Metadata Id',
targetColumnMap: {
Expand All @@ -116,15 +116,15 @@ export const seedViewFilterFieldMetadata = async (
icon: null,
isNullable: false,
isSystem: false,
defaultValue: { value: '' },
defaultValue: undefined,
},
{
id: SeedViewFilterFieldMetadataIds.View,
objectMetadataId: SeedObjectMetadataIds.ViewFilter,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.TEXT,
type: FieldMetadataType.UUID,
name: 'viewId',
label: 'View Id',
targetColumnMap: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const seedViewSortFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.TEXT,
type: FieldMetadataType.UUID,
name: 'fieldMetadataId',
label: 'Field Metadata Id',
targetColumnMap: {
Expand All @@ -114,15 +114,15 @@ export const seedViewSortFieldMetadata = async (
icon: null,
isNullable: false,
isSystem: false,
defaultValue: { value: '' },
defaultValue: undefined,
},
{
id: SeedViewSortFieldMetadataIds.View,
objectMetadataId: SeedObjectMetadataIds.ViewSort,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.TEXT,
type: FieldMetadataType.UUID,
name: 'viewId',
label: 'View Id',
targetColumnMap: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const seedViewFieldMetadata = async (
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.TEXT,
type: FieldMetadataType.UUID,
name: 'objectMetadataId',
label: 'Object Metadata Id',
targetColumnMap: {
Expand All @@ -134,7 +134,7 @@ export const seedViewFieldMetadata = async (
icon: null,
isNullable: false,
isSystem: false,
defaultValue: { value: '' },
defaultValue: undefined,
},
{
id: SeedViewFieldMetadataIds.Type,
Expand All @@ -152,7 +152,7 @@ export const seedViewFieldMetadata = async (
icon: null,
isNullable: false,
isSystem: false,
defaultValue: { value: '' },
defaultValue: { value: 'table' },
},
{
id: SeedViewFieldMetadataIds.ViewFields,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export enum SeedWorkspaceMemberFieldMetadataIds {
AvatarUrl = '20202020-7ba6-40d5-934b-17146183a212',
Locale = '20202020-10f6-4df9-8d6f-a760b65bd800',
ColorScheme = '20202020-83f2-4c5f-96b0-0c51ecc160e3',
AllowImpersonation = '20202020-bb19-44a1-8156-8866f87a5f42',
UserId = '20202020-f2c1-4ca1-9ca5-7b9d5cc87eb0',
AuthoredActivities = '20202020-37a0-4db4-9c9f-fd3e3f4e47fc',
AssignedActivities = '20202020-ac05-44b9-9526-764dd5ce14e2',
Expand Down Expand Up @@ -178,7 +177,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
icon: 'IconColorSwatch',
isNullable: true,
isSystem: false,
defaultValue: undefined,
defaultValue: { value: 'Light' },
},
{
id: SeedWorkspaceMemberFieldMetadataIds.Locale,
Expand All @@ -196,7 +195,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
icon: 'IconLanguage',
isNullable: false,
isSystem: false,
defaultValue: { value: 'fr' },
defaultValue: { value: 'en' },
},

// Relationships
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const seedWorkspaceMember = async (
'nameLastName',
'locale',
'colorScheme',
'allowImpersonation',
'userId',
])
.orIgnore()
Expand All @@ -34,7 +33,6 @@ export const seedWorkspaceMember = async (
nameLastName: 'Apple',
locale: 'en',
colorScheme: 'Light',
allowImpersonation: true,
userId: SeedUserIds.Tim,
},
{
Expand All @@ -43,7 +41,6 @@ export const seedWorkspaceMember = async (
nameLastName: 'Ive',
locale: 'en',
colorScheme: 'Light',
allowImpersonation: true,
userId: SeedUserIds.Jony,
},
{
Expand All @@ -52,7 +49,6 @@ export const seedWorkspaceMember = async (
nameLastName: 'Shiler',
locale: 'en',
colorScheme: 'Light',
allowImpersonation: true,
userId: SeedUserIds.Phil,
},
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('convertFieldMetadataToColumnActions', () => {
{
action: 'CREATE',
columnName: 'moneyAmountMicros',
columnType: 'integer',
columnType: 'numeric',
defaultValue: 100 * 1_000_000,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ export const addCompanyTable: WorkspaceMigrationTableAction[] = [
columnName: 'domainName',
columnType: 'varchar',
action: WorkspaceMigrationColumnActionType.CREATE,
defaultValue: "''",
},
{
columnName: 'address',
columnType: 'varchar',
action: WorkspaceMigrationColumnActionType.CREATE,
defaultValue: "''",
},
{
columnName: 'employees',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ export const addViewTable: WorkspaceMigrationTableAction[] = [
},
{
columnName: 'objectMetadataId',
columnType: 'varchar',
columnType: 'uuid',
action: WorkspaceMigrationColumnActionType.CREATE,
defaultValue: "''",
},
{
columnName: 'type',
columnType: 'varchar',
action: WorkspaceMigrationColumnActionType.CREATE,
defaultValue: "''",
defaultValue: "'table'",
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ export const addViewFieldTable: WorkspaceMigrationTableAction[] = [
columns: [
{
columnName: 'fieldMetadataId',
columnType: 'varchar',
columnType: 'uuid',
action: WorkspaceMigrationColumnActionType.CREATE,
defaultValue: "''",
},
{
columnName: 'position',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ export const addViewFilterTable: WorkspaceMigrationTableAction[] = [
columns: [
{
columnName: 'fieldMetadataId',
columnType: 'varchar',
columnType: 'uuid',
action: WorkspaceMigrationColumnActionType.CREATE,
defaultValue: "''",
},
{
columnName: 'operand',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ export const addViewSortTable: WorkspaceMigrationTableAction[] = [
columns: [
{
columnName: 'fieldMetadataId',
columnType: 'varchar',
columnType: 'uuid',
action: WorkspaceMigrationColumnActionType.CREATE,
defaultValue: "''",
},
{
columnName: 'direction',
Expand Down
Loading

0 comments on commit 5038c36

Please sign in to comment.