Skip to content

Commit 3de8738

Browse files
committed
Fix blazor generation and sample
1 parent 2397f5a commit 3de8738

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

.blueprint/generate-sample/generator.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ export default class extends BaseGenerator {
6060
}
6161
},
6262
async jdlEntities() {
63-
if (this.withEntities) {
63+
if (this.withEntities) {
6464
if (this.sampleName.includes('-mongo-')) {
6565
this.jdlSample = 'app_mongo';
6666
} else if (this.sampleName.includes('-react-')) {
6767
this.jdlSample = 'app-react';
6868
} else {
6969
this.jdlSample = 'app';
7070
}
71-
if (this.sampleName.includes('oauth-')) {
72-
this.jdlSample = this.jdlSample+'_oauth';
71+
if (this.sampleName.includes('jwt-')) {
72+
this.jdlSample = this.jdlSample + '_withUserRelation';
7373
}
74-
this.jdlSample = this.jdlSample+'.jdl';
74+
this.jdlSample = this.jdlSample + '.jdl';
7575
this.copyTemplate(`samples/jdl-default/${this.jdlSample}`, this.jdlSample, { noGlob: true });
7676
}
7777
},

.blueprint/generate-sample/templates/samples/jdl-default/app-react.jdl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ enum Language {
6060
FRENCH, ENGLISH, SPANISH
6161
}
6262

63-
relationship OneToOne {
64-
Employee{internalUser} to User with builtInEntity
65-
}
66-
6763
relationship OneToOne {
6864
Country{region} to Region
6965
}

.blueprint/generate-sample/templates/samples/jdl-default/app-react_oauth.jdl renamed to .blueprint/generate-sample/templates/samples/jdl-default/app-react_withUserRelation.jdl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ enum Language {
6060
FRENCH, ENGLISH, SPANISH
6161
}
6262

63+
relationship OneToOne {
64+
Employee{internalUser} to User with builtInEntity
65+
}
66+
6367
relationship OneToOne {
6468
Country{region} to Region
6569
}

.blueprint/generate-sample/templates/samples/jdl-default/app.jdl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ relationship OneToOne {
8686
Department{location} to Location
8787
}
8888

89-
relationship OneToOne {
90-
Employee{internalUser} to User with builtInEntity
91-
}
92-
9389
// defining multiple OneToMany relationships with comments
9490
relationship OneToMany {
9591
Employee to Job{employee},

.blueprint/generate-sample/templates/samples/jdl-default/app_mongo.jdl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ enum Language {
6060
FRENCH, ENGLISH, SPANISH
6161
}
6262

63-
relationship OneToOne {
64-
Employee{internalUser} to User with builtInEntity
65-
}
66-
6763
relationship OneToOne {
6864
Country{region} to Region
6965
}

.blueprint/generate-sample/templates/samples/jdl-default/app_mongo_oauth.jdl renamed to .blueprint/generate-sample/templates/samples/jdl-default/app_mongo_withUserRelation.jdl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ enum Language {
6060
FRENCH, ENGLISH, SPANISH
6161
}
6262

63+
relationship OneToOne {
64+
Employee{internalUser} to User with builtInEntity
65+
}
66+
6367
relationship OneToOne {
6468
Country{region} to Region
6569
}

.blueprint/generate-sample/templates/samples/jdl-default/app_oauth.jdl renamed to .blueprint/generate-sample/templates/samples/jdl-default/app_withUserRelation.jdl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ relationship OneToOne {
8686
Department{location} to Location
8787
}
8888

89+
relationship OneToOne {
90+
Employee{internalUser} to User with builtInEntity
91+
}
92+
8993
// defining multiple OneToMany relationships with comments
9094
relationship OneToMany {
9195
Employee to Job{employee},

generators/blazor/templates/src/client/Project.Client/Models/_dotnetEntityModel_.cs.ejs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ public class <%= asModel(entityClassName) %> : BaseModel<<%= primaryKeyType %>>
6565
const relationshipFieldNamePascalized = relationships[idx].relationshipFieldNamePascalized;
6666
if (relationshipType === 'one-to-one') { _%>
6767
public <%= getPrimaryKeyType(relationships[idx].otherEntity) %> <%= relationshipFieldNamePascalized %>Id { get; set; }
68-
<%_ }
68+
<%_ }
6969
if(relationshipType === 'one-to-many') { _%>
7070
public IList<<%= asModel(otherEntityNamePascalized) %>> <%= relationshipFieldNamePascalizedPlural %> { get; set; } = new List<<%= asModel(otherEntityNamePascalized) %>>();
7171
<%_ } else if (relationshipType === 'many-to-one') {
7272
if (relationshipRequired) { _%>
7373
[Required]
74+
<%_ } _%>
7475
public <%= getPrimaryKeyType(relationships[idx].otherEntity) %> <%= relationshipFieldNamePascalized %>Id { get; set; }
75-
<%_ }
76-
} else if (relationshipType === 'many-to-many') { _%>
76+
<%_ } else if (relationshipType === 'many-to-many') { _%>
7777
public IList<<%= asModel(otherEntityNamePascalized) %>> <%= relationshipFieldNamePascalizedPlural %> { get; set; } = new List<<%= asModel(otherEntityNamePascalized) %>>();
7878
<%_ } _%>
7979

0 commit comments

Comments
 (0)