mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Fix relation attribute type, add back relation and target properties
This commit is contained in:
parent
517212d141
commit
78e6952af9
@ -7,6 +7,10 @@ export type BasicRelationType =
|
||||
| 'manyToMany'
|
||||
| 'morphOne'
|
||||
| 'morphMany';
|
||||
export type BasicMorphRelationType = Extract<
|
||||
BasicRelationType,
|
||||
Utils.String.Prefix<string, 'morph'>
|
||||
>;
|
||||
export type PolymorphicRelationType = 'morphToOne' | 'morphToMany';
|
||||
export type RelationType = BasicRelationType | PolymorphicRelationType;
|
||||
|
||||
@ -17,7 +21,7 @@ export type BasicRelationProperties<
|
||||
> = {
|
||||
relation: TRelationType;
|
||||
target: TTarget;
|
||||
} & TRelationType extends Utils.String.Suffix<'morph', 'One' | 'Many'>
|
||||
} & (TRelationType extends BasicMorphRelationType
|
||||
? {
|
||||
morphBy?: Utils.Object.KeysBy<
|
||||
Common.Schemas[TTarget]['attributes'],
|
||||
@ -27,7 +31,7 @@ export type BasicRelationProperties<
|
||||
: {
|
||||
inversedBy?: RelationsKeysFromTo<TTarget, TOrigin>;
|
||||
mappedBy?: RelationsKeysFromTo<TTarget, TOrigin>;
|
||||
};
|
||||
});
|
||||
|
||||
export interface PolymorphicRelationProperties<TRelationType extends PolymorphicRelationType> {
|
||||
relation: TRelationType;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user