Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Embedded entities with entity schema #8626

Merged

Conversation

pnkp
Copy link
Contributor

@pnkp pnkp commented Feb 12, 2022

Description of change

  • Added embeddeds field into EntitySchemaOptions
  • Added transformation to EntitySchemaTransformer for embedded entities
  • Updated docs
  • Created new tests cases for EntitySceham with Embedded Entities
  • Changed type of field: target in EmbeddedMetadataArgs

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Feat #3632
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@@ -1,4 +1,4 @@
/**
* Table type. Tables can be closure, junction,, etc.
*/
export type TableType = "regular"|"view"|"junction"|"closure"|"closure-junction"|"entity-child";
export type TableType = "regular"|"view"|"junction"|"closure"|"closure-junction"|"entity-child"|"embedded";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt we need it. Embeds already supported and everything work correctly without this new table type. You just need properly convert entity schema definitions into metadata just like what decorator-based stuff does.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pleerock I did a lot of changes. Could you check again?

@pnkp pnkp force-pushed the feature/embedded-entities-with-entity-schema branch 10 times, most recently from 6a0885c to cc323f8 Compare February 13, 2022 19:20
@pnkp pnkp marked this pull request as ready for review February 13, 2022 19:21

export const NameEntitySchema = new EntitySchema<Name>({
name: "name",
target: Name, // target field is required for Embedded Entity!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be required. We should be able to use entity schemas without targets for sure. Most people don't use entity schemas without classes, just with a regular types/interfaces.

@pnkp pnkp force-pushed the feature/embedded-entities-with-entity-schema branch from cc323f8 to fd14155 Compare February 16, 2022 22:18
Added `embeddeds` field into EntitySchemaOptions
Added transformation to MetadataArgsStorage for embedded entities
Updated docs
Created new tests cases for EntitySchema with Embedded Entities
Changed type for field: `target` in EmbeddedMetadataArgs

CLOSES: typeorm#3632
@pnkp pnkp force-pushed the feature/embedded-entities-with-entity-schema branch from fd14155 to a18164a Compare February 16, 2022 22:29
@pleerock
Copy link
Member

Think we can merge it.

@pleerock pleerock merged commit 7dbe956 into typeorm:master Feb 17, 2022
@pleerock
Copy link
Member

Thanks for contribution!

@pnkp pnkp deleted the feature/embedded-entities-with-entity-schema branch February 17, 2022 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants