Fix flat field metadata date type (#16445)
# Introduction Following https://github.com/twentyhq/twenty/pull/16420
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
export type CastRecordTypeOrmDatePropertiesToString<T> = {
|
||||
[P in keyof T as [T[P]] extends [never]
|
||||
? never
|
||||
: [NonNullable<T[P]>] extends [never]
|
||||
? never
|
||||
: NonNullable<T[P]> extends Date
|
||||
? P
|
||||
: never]: null extends T[P] ? string | null : string;
|
||||
};
|
||||
+4
-15
@@ -1,7 +1,6 @@
|
||||
import { type SyncableEntity } from 'src/engine/workspace-manager/workspace-sync/interfaces/syncable-entity.interface';
|
||||
|
||||
import { type ExtractRecordTypeOrmNonNullableDateProperties } from 'src/engine/workspace-manager/workspace-migration-v2/types/extract-record-typeorm-non-nullable-date-properties.type';
|
||||
import { type ExtractRecordTypeOrmNullableDateProperties } from 'src/engine/workspace-manager/workspace-migration-v2/types/extract-record-typeorm-nullable-date-properties.type';
|
||||
import { type CastRecordTypeOrmDatePropertiesToString } from 'src/engine/metadata-modules/flat-entity/types/cast-record-typeorm-date-properties-to-string.type';
|
||||
import { type NonNullableProperties } from 'src/types/non-nullable-properties.type';
|
||||
|
||||
export type SyncableFlatEntity = NonNullableProperties<
|
||||
@@ -11,23 +10,13 @@ export type SyncableFlatEntity = NonNullableProperties<
|
||||
applicationId: string | null;
|
||||
};
|
||||
|
||||
export type EntityNullableDateProperties<TEntity> =
|
||||
ExtractRecordTypeOrmNullableDateProperties<TEntity>;
|
||||
|
||||
export type EntityNonNullableDateProperties<TEntity> =
|
||||
ExtractRecordTypeOrmNonNullableDateProperties<TEntity>;
|
||||
|
||||
export type FlatEntityFrom<
|
||||
TEntity,
|
||||
TEntityRelationProperties extends keyof TEntity,
|
||||
> = Omit<
|
||||
TEntity,
|
||||
| TEntityRelationProperties
|
||||
| EntityNonNullableDateProperties<TEntity>
|
||||
| EntityNullableDateProperties<TEntity>
|
||||
| 'application'
|
||||
> & {
|
||||
[P in EntityNonNullableDateProperties<TEntity>]: string;
|
||||
} & {
|
||||
[P in EntityNullableDateProperties<TEntity>]: string | null;
|
||||
};
|
||||
| keyof CastRecordTypeOrmDatePropertiesToString<TEntity>
|
||||
> &
|
||||
CastRecordTypeOrmDatePropertiesToString<TEntity>;
|
||||
|
||||
Reference in New Issue
Block a user