Skip to content

Commit

Permalink
Merge branch 'master' into minor
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Dec 14, 2023
2 parents f83455c + 990de00 commit 01ad798
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/core/e2e/custom-field-relations.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,10 @@ describe('Custom field relations', () => {
customEntity = await assertFound(
customEntityRepository.findOne({
where: { id: customEntityId },
relations: ['customEntityListInverse', 'customEntityInverse'],
relations: {
customEntityInverse: true,
customEntityListInverse: true,
},
}),
);
});
Expand Down
11 changes: 9 additions & 2 deletions packages/core/e2e/fixtures/test-plugins/with-custom-entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ import { Collection, PluginCommonModule, VendureEntity, VendurePlugin } from '@v
import gql from 'graphql-tag';
import { DeepPartial, Entity, ManyToMany, OneToMany } from 'typeorm';

declare module '@vendure/core/dist/entity/custom-entity-fields' {
interface CustomCollectionFields {
customEntity: TestCustomEntity;
customEntityList: TestCustomEntity[];
}
}

@Entity()
export class TestCustomEntity extends VendureEntity {
constructor(input?: DeepPartial<TestCustomEntity>) {
super(input);
}

@ManyToMany(() => Collection, x => (x as any).customFields?.customEntityList, {
@ManyToMany(() => Collection, c => c.customFields?.customEntityList, {
eager: true,
})
customEntityListInverse: Collection[];

@OneToMany(() => Collection, (a: Collection) => (a.customFields as any).customEntity)
@OneToMany(() => Collection, c => c.customFields.customEntity)
customEntityInverse: Collection[];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export type RelationCustomFieldConfig = TypedCustomFieldConfig<
entity: Type<VendureEntity>;
graphQLType?: string;
eager?: boolean;
inverseSide?: string | ((object: VendureEntity) => any);
inverseSide?: string | ((object: any) => any);
};

/**
Expand Down

0 comments on commit 01ad798

Please sign in to comment.