Skip to content

Commit

Permalink
refactor: provide facades via extension module
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi committed Sep 7, 2020
1 parent 91eb186 commit b551242
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { NgModule } from '@angular/core';

import { SharedModule } from 'ish-shared/shared.module';

import { <%= classify(name) %>Facade } from './facades/<%= dasherize(name) %>.facade';
import { <%= classify(name) %>StoreModule } from './store/<%= dasherize(name) %>-store.module';

@NgModule({
imports: [SharedModule, <%= classify(name) %>StoreModule],
declarations: [],
exports: [SharedModule],
providers: [<%= classify(name) %>Facade],
})
export class <%= classify(name) %>Module {}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Store, select } from '@ngrx/store';
import { get<%= classify(name) %>State } from '../store/<%= dasherize(name) %>-store';

// tslint:disable:member-ordering
@Injectable({ providedIn: 'root' })
@Injectable()
export class <%= classify(name) %>Facade {
constructor(private store: Store<{}>) {}

Expand Down
3 changes: 2 additions & 1 deletion src/app/extensions/captcha/exports/captcha-exports.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

import { CaptchaFacade } from '../facades/captcha.facade';
import { SitekeyProviderService } from '../services/sitekey-provider/sitekey-provider.service';

import { LazyCaptchaComponent } from './lazy-captcha/lazy-captcha.component';
Expand All @@ -9,6 +10,6 @@ import { LazyCaptchaComponent } from './lazy-captcha/lazy-captcha.component';
imports: [CommonModule],
declarations: [LazyCaptchaComponent],
exports: [LazyCaptchaComponent],
providers: [SitekeyProviderService],
providers: [SitekeyProviderService, CaptchaFacade],
})
export class CaptchaExportsModule {}
2 changes: 1 addition & 1 deletion src/app/extensions/captcha/facades/captcha.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type CaptchaTopic =
| 'register';

// tslint:disable:member-ordering
@Injectable({ providedIn: 'root' })
@Injectable()
export class CaptchaFacade {
constructor(private store: Store) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
updateOrderTemplate,
} from '../store/order-template';

@Injectable({ providedIn: 'root' })
@Injectable()
export class OrderTemplatesFacade {
constructor(private store: Store) {}

Expand Down
2 changes: 2 additions & 0 deletions src/app/extensions/order-templates/order-templates.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';

import { SharedModule } from 'ish-shared/shared.module';

import { OrderTemplatesFacade } from './facades/order-templates.facade';
import { BasketCreateOrderTemplateComponent } from './shared/basket-create-order-template/basket-create-order-template.component';
import { OrderTemplatePreferencesDialogComponent } from './shared/order-template-preferences-dialog/order-template-preferences-dialog.component';
import { ProductAddToOrderTemplateComponent } from './shared/product-add-to-order-template/product-add-to-order-template.component';
Expand All @@ -17,5 +18,6 @@ import { OrderTemplatesStoreModule } from './store/order-templates-store.module'
SelectOrderTemplateModalComponent,
],
exports: [OrderTemplatePreferencesDialogComponent, SelectOrderTemplateModalComponent],
providers: [OrderTemplatesFacade],
})
export class OrderTemplatesModule {}
2 changes: 1 addition & 1 deletion src/app/extensions/quoting/facades/quoting.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const getQuotesAndQuoteRequests = createSelector(getCurrentQuotes, getCurrentQuo
)[] => [...quotes, ...quoteRequests]);

// tslint:disable:member-ordering
@Injectable({ providedIn: 'root' })
@Injectable()
export class QuotingFacade {
constructor(private store: Store) {}

Expand Down
2 changes: 2 additions & 0 deletions src/app/extensions/quoting/quoting.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';

import { SharedModule } from 'ish-shared/shared.module';

import { QuotingFacade } from './facades/quoting.facade';
import { BasketAddToQuoteComponent } from './shared/basket-add-to-quote/basket-add-to-quote.component';
import { ProductAddToQuoteDialogComponent } from './shared/product-add-to-quote-dialog/product-add-to-quote-dialog.component';
import { ProductAddToQuoteComponent } from './shared/product-add-to-quote/product-add-to-quote.component';
Expand All @@ -21,5 +22,6 @@ import { QuotingStoreModule } from './store/quoting-store.module';
QuoteWidgetComponent,
],
exports: [QuoteEditComponent, QuoteStateComponent, SharedModule],
providers: [QuotingFacade],
})
export class QuotingModule {}
2 changes: 1 addition & 1 deletion src/app/extensions/tacton/facades/tacton.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '../store/tacton-config';

// tslint:disable:member-ordering
@Injectable({ providedIn: 'root' })
@Injectable()
export class TactonFacade {
constructor(private store: Store) {}

Expand Down
2 changes: 2 additions & 0 deletions src/app/extensions/tacton/tacton.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { NgModule } from '@angular/core';

import { SharedModule } from 'ish-shared/shared.module';

import { TactonFacade } from './facades/tacton.facade';
import { TactonConfigureProductComponent } from './shared/tacton-configure-product/tacton-configure-product.component';
import { TactonStoreModule } from './store/tacton-store.module';

@NgModule({
imports: [SharedModule, TactonStoreModule],
declarations: [TactonConfigureProductComponent],
exports: [SharedModule],
providers: [TactonFacade],
})
export class TactonModule {}
2 changes: 1 addition & 1 deletion src/app/extensions/wishlists/facades/wishlists.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '../store/wishlist';

// tslint:disable:member-ordering
@Injectable({ providedIn: 'root' })
@Injectable()
export class WishlistsFacade {
constructor(private store: Store) {}

Expand Down
2 changes: 2 additions & 0 deletions src/app/extensions/wishlists/wishlists.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';

import { SharedModule } from 'ish-shared/shared.module';

import { WishlistsFacade } from './facades/wishlists.facade';
import { ProductAddToWishlistComponent } from './shared/product-add-to-wishlist/product-add-to-wishlist.component';
import { SelectWishlistModalComponent } from './shared/select-wishlist-modal/select-wishlist-modal.component';
import { WishlistPreferencesDialogComponent } from './shared/wishlist-preferences-dialog/wishlist-preferences-dialog.component';
Expand All @@ -19,5 +20,6 @@ import { WishlistsStoreModule } from './store/wishlists-store.module';
WishlistsLinkComponent,
],
exports: [SelectWishlistModalComponent, WishlistPreferencesDialogComponent],
providers: [WishlistsFacade],
})
export class WishlistsModule {}

1 comment on commit b551242

@github-actions
Copy link

Choose a reason for hiding this comment

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

Azure Demo Servers are available:

Please sign in to comment.