Skip to content

Commit ef5f972

Browse files
authored
Fix: isBuiltInUser dropped but still used (#31803)
1 parent 609880d commit ef5f972

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

generators/base-entity-changes/generator.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ export default abstract class BaseEntityChangesGenerator<
136136
}
137137
}
138138

139+
if (application.generateBuiltInUserEntity && !previousEntitiesByName.User) {
140+
previousEntitiesByName.User = { name: 'User', builtIn: true } as any;
141+
}
142+
139143
const entities = Object.values(previousEntitiesByName);
140144
loadEntitiesAnnotations(entities);
141145
loadEntitiesOtherSide(entities);

generators/entity/prompts.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ async function askForRelationship(this: EntityGenerator, ...args: any[]) {
779779
'many-to-one',
780780
'many-to-many',
781781
'one-to-one',
782-
...(this.isBuiltInUser(response.otherEntityName) ? [] : ['one-to-many']),
782+
...(application.generateBuiltInUserEntity && response.otherEntityName.toLowerCase() === 'user' ? [] : ['one-to-many']),
783783
],
784784
default: 0,
785785
},
@@ -792,7 +792,7 @@ async function askForRelationship(this: EntityGenerator, ...args: any[]) {
792792
},
793793
{
794794
when: answers => {
795-
if (this.isBuiltInUser(answers.otherEntityName)) {
795+
if (application.generateBuiltInUserEntity && answers.otherEntityName.toLowerCase() === 'user)') {
796796
answers.bidirectional = false;
797797
return false;
798798
}
@@ -860,7 +860,7 @@ async function askForRelationship(this: EntityGenerator, ...args: any[]) {
860860
otherEntityRelationshipName: answers.otherEntityRelationshipName,
861861
};
862862

863-
if (this.isBuiltInUser(answers.otherEntityName)) {
863+
if (application.generateBuiltInUserEntity && answers.otherEntityName.toLowerCase() === 'user') {
864864
relationship.otherEntityRelationshipName = lowerFirst(name);
865865
}
866866

0 commit comments

Comments
 (0)