Skip to content

Commit

Permalink
No temp injection #10557
Browse files Browse the repository at this point in the history
To avoid the temptation of mis-using directly
  • Loading branch information
PowerKiKi committed Oct 8, 2024
1 parent 9482aa5 commit 491970b
Show file tree
Hide file tree
Showing 29 changed files with 30 additions and 86 deletions.
4 changes: 1 addition & 3 deletions client/app/admin/comments/comment/comment.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export class CommentComponent extends NaturalAbstractDetail<CommentService, Natu
public readonly permissionsService = inject(PermissionsService);

public constructor() {
const commentService = inject(CommentService);

super('comment', commentService);
super('comment', inject(CommentService));
}
}
4 changes: 1 addition & 3 deletions client/app/admin/comments/comments/comments.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ export class CommentsComponent extends NaturalAbstractList<CommentService> imple
];

public constructor() {
const service = inject(CommentService);

super(service);
super(inject(CommentService));
}
}
4 changes: 1 addition & 3 deletions client/app/admin/events/event/event.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ export class EventComponent extends NaturalAbstractDetail<EventService, NaturalS
public readonly permissionsService = inject(PermissionsService);

public constructor() {
const eventService = inject(EventService);

super('event', eventService);
super('event', inject(EventService));
}
}
4 changes: 1 addition & 3 deletions client/app/admin/events/events/events.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ export class EventsComponent extends NaturalAbstractList<EventService> implement
];

public constructor() {
const service = inject(EventService);

super(service);
super(inject(EventService));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ export class FacilitatorDocumentComponent extends NaturalAbstractDetail<
private readonly fileService = inject(FilesService);

public constructor() {
const facilitatorDocumentService = inject(FacilitatorDocumentsService);

super('facilitatorDocument', facilitatorDocumentService);
super('facilitatorDocument', inject(FacilitatorDocumentsService));
}

public createFileAndLink(file: File): Observable<CreateFile['createFile']> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export class FacilitatorDocumentsComponent extends NaturalAbstractList<Facilitat
public override columnsForTable = ['name', 'category', 'file'];

public constructor() {
const facilitatorDocumentService = inject(FacilitatorDocumentsService);

super(facilitatorDocumentService);
super(inject(FacilitatorDocumentsService));
}
}
4 changes: 1 addition & 3 deletions client/app/admin/newses/news/news.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ export class NewsComponent extends NaturalAbstractDetail<NewsService, NaturalSeo
public readonly permissionsService = inject(PermissionsService);

public constructor() {
const newsService = inject(NewsService);

super('news', newsService);
super('news', inject(NewsService));
}
}
4 changes: 1 addition & 3 deletions client/app/admin/newses/newses/newses.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export class NewsesComponent extends NaturalAbstractList<NewsService> implements
];

public constructor() {
const service = inject(NewsService);

super(service);
super(inject(NewsService));
}
}
4 changes: 1 addition & 3 deletions client/app/admin/order/order-line/order-line.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ export class OrderLineComponent
public readonly subscriptionService = inject(SubscriptionService);

public constructor() {
const orderLineService = inject(OrderLineService);

super('orderLine', orderLineService);
super('orderLine', inject(OrderLineService));
}
}
4 changes: 1 addition & 3 deletions client/app/admin/order/order-lines/order-lines.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ export class OrderLinesComponent extends NaturalAbstractList<OrderLineService> i
@Input() public override pageSizeOptions = [5, 25, 50, 100, 200];

public constructor() {
const service = inject(OrderLineService);

super(service);
super(inject(OrderLineService));

this.naturalSearchFacets = orderLines();
}
Expand Down
4 changes: 1 addition & 3 deletions client/app/admin/order/orders/orders.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ export class OrdersComponent extends NaturalAbstractList<OrderService> implement
];

public constructor() {
const service = inject(OrderService);

super(service);
super(inject(OrderService));

this.naturalSearchFacets = orders();
}
Expand Down
4 changes: 2 additions & 2 deletions client/app/admin/products/product/product.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<natural-select
formControlName="review"
placeholder="Revue dont est extrait cet article"
[service]="productService"
[service]="service"
[navigateTo]="['/admin/product', form.get('event')?.value?.id]"
[filter]="{
groups: [
Expand Down Expand Up @@ -293,7 +293,7 @@ <h2 class="mat-h2">Tags</h2>
groups: [{conditions: [{inversedRelatedProducts: {have: {values: [data.model.id]}}}]}],
}"
[main]="data.model"
[service]="productService"
[service]="service"
>
<ng-template let-item="item">
<div class="nat-horizontal nat-align nat-gap-10">
Expand Down
4 changes: 1 addition & 3 deletions client/app/admin/products/product/product.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ export class ProductComponent extends NaturalAbstractDetail<ProductService, Natu
public reviewXorArticleErrorStateMatcher = new XorErrorStateMatcher('reviewXorArticle');

public constructor() {
const productService = inject(ProductService);

super('product', productService);
super('product', inject(ProductService));
}

public createFileAndLink(file: File): Observable<CreateFile['createFile']> {
Expand Down
4 changes: 1 addition & 3 deletions client/app/admin/products/products/products.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ export class ProductsComponent extends NaturalAbstractList<ProductService> imple
];

public constructor() {
const productService = inject(ProductService);

super(productService);
super(inject(ProductService));

this.naturalSearchFacets = productsAdmin();
}
Expand Down
4 changes: 1 addition & 3 deletions client/app/admin/sessions/session/session.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ export class SessionComponent extends NaturalAbstractDetail<SessionService, Natu
public datesForm!: FormArray;

public constructor() {
const sessionService = inject(SessionService);

super('session', sessionService);
super('session', inject(SessionService));
}

public override ngOnInit(): void {
Expand Down
4 changes: 1 addition & 3 deletions client/app/admin/sessions/sessions/sessions.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ export class SessionsComponent extends NaturalAbstractList<SessionService> imple
];

public constructor() {
const sessionService = inject(SessionService);

super(sessionService);
super(inject(SessionService));

this.naturalSearchFacets = sessions();
}
Expand Down
4 changes: 1 addition & 3 deletions client/app/admin/users/user/user.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ export class UserComponent extends NaturalAbstractDetail<UserService, NaturalSeo
private userRolesAvailable: UserRole[] = [];

public constructor() {
const userService = inject(UserService);

super('user', userService);
super('user', inject(UserService));
}

public override ngOnInit(): void {
Expand Down
4 changes: 1 addition & 3 deletions client/app/admin/users/users/users.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ export class UsersComponent extends NaturalAbstractList<UserService> implements
public usersEmailAndName: string | null = null;

public constructor() {
const userService = inject(UserService);

super(userService);
super(inject(UserService));

this.naturalSearchFacets = users();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ export class CommentListComponent extends NaturalAbstractList<CommentService> im
public newCommentValue = '';

public constructor() {
const service = inject(CommentService);

super(service);
super(inject(CommentService));
this.persistSearch = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import {CommonModule} from '@angular/common';
})
export class EventPageComponent extends NaturalAbstractDetail<EventService> implements OnInit {
public constructor() {
const eventService = inject(EventService);

super('event', eventService);
super('event', inject(EventService));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export class EventsPageComponent extends AbstractInfiniteLoadList<EventService>
};

public constructor() {
const service = inject(EventService);

super(service);
super(inject(EventService));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export class NewsPageComponent extends NaturalAbstractDetail<NewsService> implem
public readonly permissionsService = inject(PermissionsService);

public constructor() {
const newsService = inject(NewsService);

super('news', newsService);
super('news', inject(NewsService));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export class NewsesPageComponent extends AbstractInfiniteLoadList<NewsService> {
};

public constructor() {
const service = inject(NewsService);

super(service);
super(inject(NewsService));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ export class ProductPageComponent extends NaturalAbstractDetail<ProductService>
public url: string;

public constructor() {
const productService = inject(ProductService);

super('product', productService);
super('product', inject(ProductService));

this.url = this.router.url;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ export class ProductsPageComponent extends AbstractInfiniteLoadList<ProductServi
public override defaultPagination = {pageSize: 12, pageIndex: 0, offset: null};

public constructor() {
const productService = inject(ProductService);

super(productService);
super(inject(ProductService));
}

public override ngOnInit(): void {
Expand Down
4 changes: 1 addition & 3 deletions client/app/profile/components/account/account.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ export class AccountComponent extends NaturalAbstractDetail<UserService> impleme
public passwordMailSending = false;

public constructor() {
const userService = inject(UserService);

super('user', userService);
super('user', inject(UserService));
}

public override ngOnInit(): void {
Expand Down
4 changes: 1 addition & 3 deletions client/app/profile/components/history/history.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ export class HistoryComponent extends NaturalAbstractList<OrderService> implemen
public readonly permissionsService = inject(PermissionsService);

public constructor() {
const service = inject(OrderService);

super(service);
super(inject(OrderService));
this.columnsForTable = ['creationDate', 'status', 'balance'];

this.naturalSearchFacets = orders();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ export class PurchasesComponent extends NaturalAbstractList<PurchaseService> imp
public ProductType = ProductType;

public constructor() {
const service = inject(PurchaseService);

super(service);
super(inject(PurchaseService));

this.persistSearch = false;
}
Expand Down
4 changes: 1 addition & 3 deletions client/app/shared/testing/MockApolloProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ import {schema as introspectionResult} from './../../../../data/tmp/schema';
})
class MockApollo extends Apollo {
public constructor() {
const ngZone = inject(NgZone);

super(ngZone);
super(inject(NgZone));
this.client = this.createMockClient();
}

Expand Down

0 comments on commit 491970b

Please sign in to comment.