Add isRemote field on object metadata (#4668)

Add isRemote field

Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
Thomas Trompette
2024-03-26 16:49:18 +01:00
committed by GitHub
parent 3acec7731c
commit d4eb75abff
11 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddIsRemoteField1711466822763 implements MigrationInterface {
name = 'AddIsRemoteField1711466822763';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "metadata"."objectMetadata" ADD "isRemote" boolean NOT NULL DEFAULT false`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "metadata"."objectMetadata" DROP COLUMN "isRemote"`,
);
}
}

View File

@ -173,6 +173,7 @@ export const computeMetadataSchemaComponents = (
description: { type: 'string' },
icon: { type: 'string' },
isCustom: { type: 'boolean' },
isRemote: { type: 'boolean' },
isActive: { type: 'boolean' },
isSystem: { type: 'boolean' },
createdAt: { type: 'string' },

View File

@ -74,6 +74,7 @@ export const currencyObjectDefinition = {
isActive: true,
isSystem: true,
isCustom: false,
isRemote: false,
} satisfies ObjectMetadataInterface;
export type CurrencyMetadata = {

View File

@ -74,6 +74,7 @@ export const fullNameObjectDefinition = {
isActive: true,
isSystem: true,
isCustom: false,
isRemote: false,
} satisfies ObjectMetadataInterface;
export type FullNameMetadata = {

View File

@ -74,6 +74,7 @@ export const linkObjectDefinition = {
isActive: true,
isSystem: true,
isCustom: false,
isRemote: false,
} satisfies ObjectMetadataInterface;
export type LinkMetadata = {

View File

@ -15,4 +15,5 @@ export interface ObjectMetadataInterface {
isSystem: boolean;
isCustom: boolean;
isActive: boolean;
isRemote: boolean;
}

View File

@ -53,6 +53,9 @@ export class ObjectMetadataDTO {
@FilterableField()
isCustom: boolean;
@FilterableField()
isRemote: boolean;
@FilterableField()
isActive: boolean;

View File

@ -55,6 +55,9 @@ export class ObjectMetadataEntity implements ObjectMetadataInterface {
@Column({ default: false })
isCustom: boolean;
@Column({ default: false })
isRemote: boolean;
@Column({ default: false })
isActive: boolean;

View File

@ -235,6 +235,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
isActive: true,
isCustom: true,
isSystem: false,
isRemote: false,
fields:
// Creating default fields.
// No need to create a custom migration for this though as the default columns are already

View File

@ -19,6 +19,7 @@ export function ObjectMetadata(
targetTableName: 'DEPRECATED',
isSystem,
isCustom: false,
isRemote: false,
description: params.description,
icon: params.icon,
gate,

View File

@ -14,5 +14,6 @@ export interface ReflectObjectMetadata extends ObjectMetadataDecoratorParams {
targetTableName: string;
isSystem: boolean;
isCustom: boolean;
isRemote: boolean;
gate?: GateDecoratorParams;
}