Skip to content

Commit

Permalink
use isActive parameter instead of isInActive() decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
gitstart-twenty committed Aug 19, 2024
1 parent 0b5e5ff commit e820bdc
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface WorkspaceFieldOptions<
defaultValue?: FieldMetadataDefaultValue<T>;
options?: FieldMetadataOptions<T>;
settings?: FieldMetadataSettings<T>;
isActive?: boolean;
}

export function WorkspaceField<T extends FieldMetadataType>(
Expand Down Expand Up @@ -55,13 +56,6 @@ export function WorkspaceField<T extends FieldMetadataType>(
propertyKey.toString(),
) ?? false;

const isInactive =
TypedReflect.getMetadata(
'workspace:is-inactive-field-metadata-args',
object,
propertyKey.toString(),
) ?? false;

const defaultValue = (options.defaultValue ??
generateDefaultValue(
options.type,
Expand All @@ -82,7 +76,7 @@ export function WorkspaceField<T extends FieldMetadataType>(
isSystem,
gate,
isDeprecated,
isInactive,
isActive: options.isActive,
});
};
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface WorkspaceFieldMetadataArgs {
readonly isDeprecated?: boolean;

/**
* Is inactive field.
* Is active field.
*/
readonly isInactive?: boolean;
readonly isActive?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export interface WorkspaceRelationMetadataArgs {
readonly gate?: Gate;

/**
* Is inactive field.
* Is active field.
*/
readonly isInactive?: boolean;
readonly isActive?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class StandardFieldFactory {
isNullable: workspaceFieldMetadataArgs.isNullable,
isCustom: workspaceFieldMetadataArgs.isDeprecated ? true : false,
isSystem: workspaceFieldMetadataArgs.isSystem ?? false,
isActive: !workspaceFieldMetadataArgs.isInactive,
isActive: workspaceFieldMetadataArgs.isActive ?? true,
},
];
}
Expand Down Expand Up @@ -223,7 +223,7 @@ export class StandardFieldFactory {
isCustom: false,
isSystem: true,
isNullable: workspaceRelationMetadataArgs.isNullable,
isActive: !workspaceRelationMetadataArgs.isInactive,
isActive: workspaceRelationMetadataArgs.isActive ?? true,
});
}

Expand All @@ -241,7 +241,7 @@ export class StandardFieldFactory {
workspaceEntityMetadataArgs?.isSystem ||
workspaceRelationMetadataArgs.isSystem,
isNullable: true,
isActive: !workspaceRelationMetadataArgs.isInactive,
isActive: workspaceRelationMetadataArgs.isActive ?? true,
});

return fieldMetadataCollection;
Expand Down
1 change: 0 additions & 1 deletion packages/twenty-server/src/utils/typed-reflect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export interface ReflectMetadataTypeMap {
['workspace:is-audit-logged-metadata-args']: false;
['workspace:is-primary-field-metadata-args']: true;
['workspace:is-deprecated-field-metadata-args']: true;
['workspace:is-inactive-field-metadata-args']: true;
}

export class TypedReflect {
Expand Down

0 comments on commit e820bdc

Please sign in to comment.