Skip to content

Commit b4c11ef

Browse files
committed
feat: use domain-name as prefix for state_key, rename facade method dispatch to load
1 parent 4afd764 commit b4c11ef

File tree

10 files changed

+15
-20
lines changed

10 files changed

+15
-20
lines changed

libs/ddd/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular-architects/ddd",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"license": "MIT",
55
"author": "Manfred Steyer",
66
"description": "Nx plugin for structuring a monorepo with domains and layers",
@@ -9,7 +9,7 @@
99
"url": "https://github.com/angular-architects/nx-ddd-plugin"
1010
},
1111
"dependencies": {
12-
"@ngrx/schematics":"^11.0.1"
12+
"@ngrx/schematics":"^12.0.0"
1313
},
1414
"main": "src/index.js",
1515
"schematics": "./collection.json"

libs/ddd/src/schematics/domain/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json-schema.org/schema",
3-
"id": "domain-options",
3+
"$id": "domain-options",
44
"type": "object",
55
"properties": {
66
"name": {

libs/ddd/src/schematics/feature/files/forDomainWithNgrx/+state/__entity@dasherize__/__entity@dasherize__.reducer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { EntityState, EntityAdapter, createEntityAdapter } from '@ngrx/entity';
44
import * as <%= classify(entity) %>Actions from './<%= dasherize(entity) %>.actions';
55
import { <%= classify(entity) %> } from '../../entities/<%= dasherize(entity) %>';
66

7-
export const <%= classify(entity).toUpperCase() %>_FEATURE_KEY = '<%= camelize(entity) %>';
7+
export const <%= classify(entity).toUpperCase() %>_FEATURE_KEY = '<%=camelize(domain)%>-<%= camelize(entity) %>';
88

99
export interface State extends EntityState<<%= classify(entity) %>> {
1010
selectedId ?: string | number; // which <%= classify(entity) %> record has been selected
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Injectable } from '@angular/core';
2+
import { select, Store } from '@ngrx/store';
23

3-
import { select, Store, Action } from '@ngrx/store';
4-
4+
import { load<%=classify(entity)%> } from '../+state/<%= dasherize(entity) %>/<%= dasherize(entity) %>.actions';
55
import * as from<%= classify(entity) %> from '../+state/<%= dasherize(entity) %>/<%= dasherize(entity) %>.reducer';
66
import * as <%= classify(entity) %>Selectors from '../+state/<%= dasherize(entity) %>/<%= dasherize(entity) %>.selectors';
77

@@ -13,7 +13,7 @@ export class <%= classify(name) %>Facade {
1313

1414
constructor(private store: Store<from<%= classify(entity) %>.<%= classify(entity) %>PartialState>) { }
1515

16-
dispatch(action: Action) {
17-
this.store.dispatch(action);
16+
load(): void {
17+
this.store.dispatch(load<%=classify(entity)%>());
1818
}
1919
}

libs/ddd/src/schematics/feature/files/forFeatureWithNgrx/__name@dasherize__.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class <%=classify(name)%>Component implements OnInit {
2121
}
2222

2323
load(): void {
24-
this.<%=camelize(name)%>Facade.dispatch(load<%=classify(entity)%>());
24+
this.<%=camelize(name)%>Facade.load();
2525
}
2626
<% } else { %>
2727
ngOnInit() {

libs/ddd/src/schematics/feature/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,8 @@ export default function (options: FeatureOptions): Rule {
5353
.split('/')
5454
.join('-');
5555
const domainNameAndDirectory = domainDirectory
56-
<<<<<<< HEAD
5756
? `${domainName}/${domainDirectory}`
5857
: `${domainName}`;
59-
=======
60-
? `${domainDirectory}/${domainName}`
61-
: `${domainName}`;
62-
>>>>>>> 4dcbf533e77349fe2ca72328488bd28040484c9f
6358
const domainNameAndDirectoryDasherized = `${domainNameAndDirectory}`
6459
.split('/')
6560
.join('-');

libs/ddd/src/schematics/feature/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json-schema.org/schema",
3-
"id": "feature-options",
3+
"$id": "feature-options",
44
"type": "object",
55
"properties": {
66
"name": {

libs/ddd/src/schematics/ui/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json-schema.org/schema",
3-
"id": "ui-options",
3+
"$id": "ui-options",
44
"type": "object",
55
"properties": {
66
"name": {

libs/ddd/src/schematics/util/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json-schema.org/schema",
3-
"id": "util-options",
3+
"$id": "util-options",
44
"type": "object",
55
"properties": {
66
"name": {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
},
3131
"private": true,
3232
"dependencies": {
33-
"@schematics/angular": "10.1.7",
34-
"@nrwl/schematics": "8.12.11",
35-
"json-schema-to-typescript": "^8.1.0"
33+
"@schematics/angular": "^12.0.0",
34+
"@nrwl/schematics": "^12.0.0"
3635
},
3736
"devDependencies": {
37+
"json-schema-to-typescript": "^8.1.0",
3838
"@nrwl/angular": "11.0.20",
3939
"@nrwl/cli": "11.0.20",
4040
"@nrwl/eslint-plugin-nx": "11.0.20",

0 commit comments

Comments
 (0)