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: support Entity Inheritance #390

Merged
merged 2 commits into from
Dec 18, 2023

Conversation

jiho-kr
Copy link
Contributor

@jiho-kr jiho-kr commented Dec 16, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #389

What is the new behavior?

Support @ChildEntity (Typeorm Entity Inheritance)

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@jiho-kr jiho-kr added the enhancement New feature or request label Dec 16, 2023
@jiho-kr jiho-kr requested a review from Pigrabbit December 16, 2023 00:56
@jiho-kr jiho-kr self-assigned this Dec 16, 2023
@jiho-kr jiho-kr changed the title feat: support @ChildEntity feat: support Entity Inheritance Dec 16, 2023
@jiho-kr jiho-kr force-pushed the feature/entity-inheritance branch from 47e28eb to 63a4d23 Compare December 16, 2023 01:00
@jiho-kr jiho-kr mentioned this pull request Dec 16, 2023
10 tasks
@jiho-kr jiho-kr merged commit 26ef5be into woowabros:main Dec 18, 2023
1 of 2 checks passed
Comment on lines +98 to +108
const tableName = (() => {
const table = getMetadataArgsStorage().tables.find(({ target }) => target === entity);
if (!table) {
throw new Error('Cannot find Table from TypeORM');
}
if (!table.name && table.type === 'entity-child') {
const discriminatorValue = getMetadataArgsStorage().discriminatorValues.find(({ target }) => target === entity)?.value;
return typeof discriminatorValue === 'string' ? discriminatorValue : discriminatorValue?.name;
}
return table.name;
})();
Copy link
Contributor

Choose a reason for hiding this comment

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

✔️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants