Skip to content

Commit 765b15a

Browse files
brandonrobertsMikeRyanDev
authored andcommitted
fix(Schematics): Make variable naming consistent for entity blueprint (#716)
1 parent 1ecd658 commit 765b15a

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

modules/schematics/src/entity/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.actions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,31 @@ export enum <%= classify(name) %>ActionTypes {
1616
export class Load<%= classify(name) %>s implements Action {
1717
readonly type = <%= classify(name) %>ActionTypes.Load<%= classify(name) %>s;
1818

19-
constructor(public payload: { <%= lowercase(name) %>s: <%= classify(name) %>[] }) {}
19+
constructor(public payload: { <%= camelize(name) %>s: <%= classify(name) %>[] }) {}
2020
}
2121

2222
export class Add<%= classify(name) %> implements Action {
2323
readonly type = <%= classify(name) %>ActionTypes.Add<%= classify(name) %>;
2424

25-
constructor(public payload: { <%= lowercase(name) %>: <%= classify(name) %> }) {}
25+
constructor(public payload: { <%= camelize(name) %>: <%= classify(name) %> }) {}
2626
}
2727

2828
export class Add<%= classify(name) %>s implements Action {
2929
readonly type = <%= classify(name) %>ActionTypes.Add<%= classify(name) %>s;
3030

31-
constructor(public payload: { <%= lowercase(name) %>s: <%= classify(name) %>[] }) {}
31+
constructor(public payload: { <%= camelize(name) %>s: <%= classify(name) %>[] }) {}
3232
}
3333

3434
export class Update<%= classify(name) %> implements Action {
3535
readonly type = <%= classify(name) %>ActionTypes.Update<%= classify(name) %>;
3636

37-
constructor(public payload: { <%= lowercase(name) %>: Update<<%= classify(name) %>> }) {}
37+
constructor(public payload: { <%= camelize(name) %>: Update<<%= classify(name) %>> }) {}
3838
}
3939

4040
export class Update<%= classify(name) %>s implements Action {
4141
readonly type = <%= classify(name) %>ActionTypes.Update<%= classify(name) %>s;
4242

43-
constructor(public payload: { <%= lowercase(name) %>s: Update<<%= classify(name) %>>[] }) {}
43+
constructor(public payload: { <%= camelize(name) %>s: Update<<%= classify(name) %>>[] }) {}
4444
}
4545

4646
export class Delete<%= classify(name) %> implements Action {

modules/schematics/src/entity/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.reducer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ export function reducer(
1818
): State {
1919
switch (action.type) {
2020
case <%= classify(name) %>ActionTypes.Add<%= classify(name) %>: {
21-
return adapter.addOne(action.payload.<%= lowercase(classify(name)) %>, state);
21+
return adapter.addOne(action.payload.<%= camelize(name) %>, state);
2222
}
2323

2424
case <%= classify(name) %>ActionTypes.Add<%= classify(name) %>s: {
25-
return adapter.addMany(action.payload.<%= lowercase(classify(name)) %>s, state);
25+
return adapter.addMany(action.payload.<%= camelize(name) %>s, state);
2626
}
2727

2828
case <%= classify(name) %>ActionTypes.Update<%= classify(name) %>: {
29-
return adapter.updateOne(action.payload.<%= lowercase(classify(name)) %>, state);
29+
return adapter.updateOne(action.payload.<%= camelize(name) %>, state);
3030
}
3131

3232
case <%= classify(name) %>ActionTypes.Update<%= classify(name) %>s: {
33-
return adapter.updateMany(action.payload.<%= lowercase(classify(name)) %>s, state);
33+
return adapter.updateMany(action.payload.<%= camelize(name) %>s, state);
3434
}
3535

3636
case <%= classify(name) %>ActionTypes.Delete<%= classify(name) %>: {
@@ -42,7 +42,7 @@ export function reducer(
4242
}
4343

4444
case <%= classify(name) %>ActionTypes.Load<%= classify(name) %>s: {
45-
return adapter.addAll(action.payload.<%= lowercase(classify(name)) %>s, state);
45+
return adapter.addAll(action.payload.<%= camelize(name) %>s, state);
4646
}
4747

4848
case <%= classify(name) %>ActionTypes.Clear<%= classify(name) %>s: {

modules/schematics/src/entity/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export default function(options: EntityOptions): Rule {
4646
]);
4747

4848
return chain([
49-
addReducerToState({ ...options, flat: true }),
50-
addReducerImportToNgModule({ ...options, flat: true }),
49+
addReducerToState({ ...options }),
50+
addReducerImportToNgModule({ ...options }),
5151
branchAndMerge(chain([mergeWith(templateSource)])),
5252
])(host, context);
5353
};

0 commit comments

Comments
 (0)