Files
twenty/packages/twenty-server/src/engine/metadata-modules/object-metadata/dtos/create-object.input.ts
T
Charles Bochet f6423f5925 Remove DataSourceService and clean up datasource migration logic (#19532)
## Summary

- **Drop the `objectMetadata.dataSourceId` foreign key and index** via a
1-22 fast instance command — column kept nullable for data preservation
- **Delete `DataSourceService`, `DataSourceModule`, and
`DataSourceException`** — all code now uses `workspace.databaseSchema`
directly
- **Remove `IS_DATASOURCE_MIGRATED` feature flag** from default flags
and all branching logic
- **Simplify workspace/object creation pipelines** —
`WorkspaceManagerService`, `DevSeederService`, and the object creation
action handler no longer route through `DataSourceService`
- **Keep `DataSourceEntity` and the `dataSource` table** for historical
data — entity stripped of all ORM relations
2026-04-10 07:34:05 +00:00

102 lines
1.9 KiB
TypeScript

import { Field, HideField, InputType } from '@nestjs/graphql';
import { Type } from 'class-transformer';
import {
IsBoolean,
IsNotEmpty,
IsOptional,
IsString,
ValidateNested,
} from 'class-validator';
import GraphQLJSON from 'graphql-type-json';
import {
type FieldMetadataSettings,
type FieldMetadataType,
} from 'twenty-shared/types';
import { IsValidMetadataName } from 'src/engine/decorators/metadata/is-valid-metadata-name.decorator';
@InputType()
export class CreateObjectInput {
@IsString()
@IsNotEmpty()
@Field()
@IsValidMetadataName()
nameSingular: string;
@IsString()
@IsNotEmpty()
@Field()
@IsValidMetadataName()
namePlural: string;
@IsString()
@IsNotEmpty()
@Field()
labelSingular: string;
@IsString()
@IsNotEmpty()
@Field()
labelPlural: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
description?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
icon?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
shortcut?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
color?: string;
@HideField()
applicationId?: string;
@HideField()
universalIdentifier?: string;
@IsBoolean()
@IsOptional()
@Field({ nullable: true })
skipNameField?: boolean;
@IsBoolean()
@IsOptional()
@Field({ nullable: true })
isRemote?: boolean;
@IsOptional()
@Field({ nullable: true })
primaryKeyColumnType?: string;
@IsOptional()
@Field(() => GraphQLJSON, { nullable: true })
primaryKeyFieldMetadataSettings?: FieldMetadataSettings<FieldMetadataType>;
@IsBoolean()
@IsOptional()
@Field({ nullable: true }) // Not nullable to me
isLabelSyncedWithName?: boolean;
}
@InputType()
export class CreateOneObjectInput {
@Type(() => CreateObjectInput)
@ValidateNested()
@Field(() => CreateObjectInput, {
description: 'The object to create',
})
object!: CreateObjectInput;
}