Skip to content

Commit

Permalink
Upgrade natural #9073 #8589 #9074 #8398 #9088
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed Sep 6, 2022
1 parent d5abed1 commit a25326c
Show file tree
Hide file tree
Showing 24 changed files with 215 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
DeleteAccountingDocument,
DeleteAccountingDocumentVariables,
} from '../../../shared/generated-types';
import {NaturalAbstractModelService} from '@ecodev/natural';
import {NaturalAbstractModelService, NaturalDebounceService} from '@ecodev/natural';

@Injectable({
providedIn: 'root',
Expand All @@ -25,9 +25,10 @@ export class AccountingDocumentService extends NaturalAbstractModelService<
DeleteAccountingDocument,
DeleteAccountingDocumentVariables
> {
public constructor(apollo: Apollo) {
public constructor(apollo: Apollo, naturalDebounceService: NaturalDebounceService) {
super(
apollo,
naturalDebounceService,
'accountingDocument',
null,
null,
Expand Down
14 changes: 12 additions & 2 deletions client/app/admin/accounts/services/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
NaturalAbstractModelService,
NaturalQueryVariablesManager,
unique,
NaturalDebounceService,
} from '@ecodev/natural';
import {Observable} from 'rxjs';
import {map} from 'rxjs/operators';
Expand All @@ -63,8 +64,17 @@ export class AccountService extends NaturalAbstractModelService<
DeleteAccounts,
DeleteAccountsVariables
> {
public constructor(apollo: Apollo) {
super(apollo, 'account', accountQuery, accountsQuery, createAccount, updateAccount, deleteAccounts);
public constructor(apollo: Apollo, naturalDebounceService: NaturalDebounceService) {
super(
apollo,
naturalDebounceService,
'account',
accountQuery,
accountsQuery,
createAccount,
updateAccount,
deleteAccounts,
);
}

protected getDefaultForServer(): AccountInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
updateBookableMetadataMutation,
} from './bookable-metadata.queries';
import {Validators} from '@angular/forms';
import {FormValidators, NaturalAbstractModelService} from '@ecodev/natural';
import {FormValidators, NaturalAbstractModelService, NaturalDebounceService} from '@ecodev/natural';
import {
BookableMetadataInput,
BookableMetadatas,
Expand All @@ -33,9 +33,10 @@ export class BookableMetadataService extends NaturalAbstractModelService<
DeleteBookableMetadatas,
DeleteBookableMetadatasVariables
> {
public constructor(apollo: Apollo) {
public constructor(apollo: Apollo, naturalDebounceService: NaturalDebounceService) {
super(
apollo,
naturalDebounceService,
'bookableMetadata',
null,
bookableMetadatasQuery,
Expand Down
11 changes: 9 additions & 2 deletions client/app/admin/bookableTags/services/bookableTag.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {Apollo} from 'apollo-angular';
import {Injectable} from '@angular/core';
import {FormAsyncValidators, FormValidators, NaturalAbstractModelService, unique} from '@ecodev/natural';
import {
FormAsyncValidators,
FormValidators,
NaturalAbstractModelService,
NaturalDebounceService,
unique,
} from '@ecodev/natural';
import {
bookableTagQuery,
bookableTagsQuery,
Expand Down Expand Up @@ -39,9 +45,10 @@ export class BookableTagService extends NaturalAbstractModelService<
DeleteBookableTags,
DeleteBookableTagsVariables
> {
public constructor(apollo: Apollo) {
public constructor(apollo: Apollo, naturalDebounceService: NaturalDebounceService) {
super(
apollo,
naturalDebounceService,
'bookableTag',
bookableTagQuery,
bookableTagsQuery,
Expand Down
18 changes: 16 additions & 2 deletions client/app/admin/bookables/services/bookable.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
NaturalAbstractModelService,
NaturalQueryVariablesManager,
unique,
NaturalDebounceService,
} from '@ecodev/natural';
import {BookableTagService} from '../../bookableTags/services/bookableTag.service';

Expand Down Expand Up @@ -99,8 +100,21 @@ export class BookableService extends NaturalAbstractModelService<
filter: {groups: [{conditions: [{bookingType: {in: {values: [BookingType.application]}}}]}]},
};

public constructor(apollo: Apollo, private readonly bookingService: BookingService) {
super(apollo, 'bookable', bookableQuery, bookablesQuery, createBookable, updateBookable, deleteBookables);
public constructor(
apollo: Apollo,
naturalDebounceService: NaturalDebounceService,
private readonly bookingService: BookingService,
) {
super(
apollo,
naturalDebounceService,
'bookable',
bookableQuery,
bookablesQuery,
createBookable,
updateBookable,
deleteBookables,
);
}

public static getFiltersByTagId(tagId: string): BookablesVariables {
Expand Down
6 changes: 3 additions & 3 deletions client/app/admin/bookables/services/image.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Apollo, gql} from 'apollo-angular';
import {Injectable} from '@angular/core';
import {userMetaFragment} from '../../../shared/queries/fragments';
import {CreateImage, CreateImageVariables, ImageInput} from '../../../shared/generated-types';
import {NaturalAbstractModelService} from '@ecodev/natural';
import {NaturalAbstractModelService, NaturalDebounceService} from '@ecodev/natural';

export const createImageMutation = gql`
mutation CreateImage($input: ImageInput!) {
Expand Down Expand Up @@ -31,8 +31,8 @@ export class ImageService extends NaturalAbstractModelService<
any,
any
> {
public constructor(apollo: Apollo) {
super(apollo, 'image', null, null, createImageMutation, null, null);
public constructor(apollo: Apollo, naturalDebounceService: NaturalDebounceService) {
super(apollo, naturalDebounceService, 'image', null, null, createImageMutation, null, null);
}

protected getDefaultForServer(): ImageInput {
Expand Down
19 changes: 16 additions & 3 deletions client/app/admin/bookables/services/usage-bookable.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
UsageBookablesVariables,
} from '../../../shared/generated-types';
import {BookingService} from '../../bookings/services/booking.service';
import {NaturalAbstractModelService} from '@ecodev/natural';
import {NaturalAbstractModelService, NaturalDebounceService} from '@ecodev/natural';
import {Observable, of} from 'rxjs';

@Injectable({
Expand All @@ -34,8 +34,21 @@ export class UsageBookableService extends NaturalAbstractModelService<
DeleteBookables,
DeleteBookablesVariables
> {
public constructor(apollo: Apollo, protected readonly bookingService: BookingService) {
super(apollo, 'bookable', bookableQuery, usageBookablesQuery, createBookable, updateBookable, deleteBookables);
public constructor(
apollo: Apollo,
naturalDebounceService: NaturalDebounceService,
protected readonly bookingService: BookingService,
) {
super(
apollo,
naturalDebounceService,
'bookable',
bookableQuery,
usageBookablesQuery,
createBookable,
updateBookable,
deleteBookables,
);
}

public getPartialVariablesForAll(): Observable<Partial<BookablesVariables>> {
Expand Down
6 changes: 3 additions & 3 deletions client/app/admin/bookings/services/PricedBooking.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Apollo} from 'apollo-angular';
import {Injectable} from '@angular/core';
import {pricedBookingsQuery} from './booking.queries';
import {Bookings, BookingsVariables} from '../../../shared/generated-types';
import {NaturalAbstractModelService} from '@ecodev/natural';
import {NaturalAbstractModelService, NaturalDebounceService} from '@ecodev/natural';

@Injectable({
providedIn: 'root',
Expand All @@ -19,7 +19,7 @@ export class PricedBookingService extends NaturalAbstractModelService<
any,
any
> {
public constructor(apollo: Apollo) {
super(apollo, 'booking', null, pricedBookingsQuery, null, null, null);
public constructor(apollo: Apollo, naturalDebounceService: NaturalDebounceService) {
super(apollo, naturalDebounceService, 'booking', null, pricedBookingsQuery, null, null, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
UpdateBooking,
UpdateBookingVariables,
} from '../../../shared/generated-types';
import {NaturalAbstractModelService} from '@ecodev/natural';
import {NaturalAbstractModelService, NaturalDebounceService} from '@ecodev/natural';
import {Observable, of} from 'rxjs';
import {BookingService} from './booking.service';

Expand All @@ -38,9 +38,14 @@ export class BookingWithOwnerService extends NaturalAbstractModelService<
DeleteBookings,
DeleteBookingsVariables
> {
public constructor(apollo: Apollo, private readonly bookingService: BookingService) {
public constructor(
apollo: Apollo,
naturalDebounceService: NaturalDebounceService,
private readonly bookingService: BookingService,
) {
super(
apollo,
naturalDebounceService,
'booking',
bookingQuery,
bookingsWithOwnerBalanceQuery,
Expand Down
25 changes: 22 additions & 3 deletions client/app/admin/bookings/services/booking.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ import {Validators} from '@angular/forms';
import {forkJoin, Observable, of} from 'rxjs';
import {map} from 'rxjs/operators';
import {BookingResolve} from '../booking';
import {formatIsoDateTime, FormValidators, NaturalAbstractModelService, NaturalEnumService} from '@ecodev/natural';
import {
formatIsoDateTime,
FormValidators,
NaturalAbstractModelService,
NaturalEnumService,
NaturalDebounceService,
} from '@ecodev/natural';
import {BookableTagService} from '../../bookableTags/services/bookableTag.service';

@Injectable({
Expand Down Expand Up @@ -178,8 +184,21 @@ export class BookingService extends NaturalAbstractModelService<
};
}

public constructor(apollo: Apollo, private readonly enumService: NaturalEnumService) {
super(apollo, 'booking', bookingQuery, bookingsQuery, createBooking, updateBooking, deleteBookings);
public constructor(
apollo: Apollo,
naturalDebounceService: NaturalDebounceService,
private readonly enumService: NaturalEnumService,
) {
super(
apollo,
naturalDebounceService,
'booking',
bookingQuery,
bookingsQuery,
createBooking,
updateBooking,
deleteBookings,
);
}

protected getDefaultForServer(): BookingInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
FormValidators,
money,
NaturalAbstractModelService,
NaturalDebounceService,
NaturalQueryVariablesManager,
SortingOrder,
} from '@ecodev/natural';
Expand Down Expand Up @@ -49,9 +50,10 @@ export class ExpenseClaimService extends NaturalAbstractModelService<
DeleteExpenseClaims,
DeleteExpenseClaimsVariables
> {
public constructor(apollo: Apollo) {
public constructor(apollo: Apollo, naturalDebounceService: NaturalDebounceService) {
super(
apollo,
naturalDebounceService,
'expenseClaim',
expenseClaimQuery,
expenseClaimsQuery,
Expand Down
21 changes: 18 additions & 3 deletions client/app/admin/licenses/services/license.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {Apollo} from 'apollo-angular';
import {Injectable} from '@angular/core';
import {FormAsyncValidators, FormValidators, NaturalAbstractModelService, unique} from '@ecodev/natural';
import {
FormAsyncValidators,
FormValidators,
NaturalAbstractModelService,
unique,
NaturalDebounceService,
} from '@ecodev/natural';
import {createLicense, deleteLicenses, licenseQuery, licensesQuery, updateLicense} from './license.queries';
import {
CreateLicense,
Expand Down Expand Up @@ -33,8 +39,17 @@ export class LicenseService extends NaturalAbstractModelService<
DeleteLicenses,
DeleteLicensesVariables
> {
public constructor(apollo: Apollo) {
super(apollo, 'license', licenseQuery, licensesQuery, createLicense, updateLicense, deleteLicenses);
public constructor(apollo: Apollo, naturalDebounceService: NaturalDebounceService) {
super(
apollo,
naturalDebounceService,
'license',
licenseQuery,
licensesQuery,
createLicense,
updateLicense,
deleteLicenses,
);
}

protected getDefaultForServer(): LicenseInput {
Expand Down
6 changes: 3 additions & 3 deletions client/app/admin/logs/services/log.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Apollo} from 'apollo-angular';
import {Injectable} from '@angular/core';
import {NaturalAbstractModelService} from '@ecodev/natural';
import {NaturalAbstractModelService, NaturalDebounceService} from '@ecodev/natural';
import {Logs, LogsVariables} from '../../../shared/generated-types';
import {logsQuery} from './log.queries';
import {Observable, of} from 'rxjs';
Expand All @@ -20,8 +20,8 @@ export class LogService extends NaturalAbstractModelService<
never,
never
> {
public constructor(apollo: Apollo) {
super(apollo, 'log', null, logsQuery, null, null, null);
public constructor(apollo: Apollo, naturalDebounceService: NaturalDebounceService) {
super(apollo, naturalDebounceService, 'log', null, logsQuery, null, null, null);
}

public getPartialVariablesForAll(): Observable<Partial<LogsVariables>> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Apollo} from 'apollo-angular';
import {Injectable} from '@angular/core';
import {FormValidators, NaturalAbstractModelService} from '@ecodev/natural';
import {FormValidators, NaturalAbstractModelService, NaturalDebounceService} from '@ecodev/natural';
import {
createTransactionTag,
deleteTransactionTags,
Expand Down Expand Up @@ -38,9 +38,10 @@ export class TransactionTagService extends NaturalAbstractModelService<
any,
any
> {
public constructor(apollo: Apollo) {
public constructor(apollo: Apollo, naturalDebounceService: NaturalDebounceService) {
super(
apollo,
naturalDebounceService,
'transactionTag',
transactionTagQuery,
transactionTagsQuery,
Expand Down
10 changes: 9 additions & 1 deletion client/app/admin/transactions/services/transaction.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import {Apollo} from 'apollo-angular';
import {Injectable} from '@angular/core';
import {Validators} from '@angular/forms';
import {formatIsoDateTime, FormValidators, Literal, NaturalAbstractModelService} from '@ecodev/natural';
import {
formatIsoDateTime,
FormValidators,
Literal,
NaturalAbstractModelService,
NaturalDebounceService,
} from '@ecodev/natural';
import {
Accounts_accounts_items,
CreateTransaction,
Expand Down Expand Up @@ -47,11 +53,13 @@ export class TransactionService extends NaturalAbstractModelService<

public constructor(
apollo: Apollo,
naturalDebounceService: NaturalDebounceService,
private readonly transactionLineService: TransactionLineService,
private accountService: AccountService,
) {
super(
apollo,
naturalDebounceService,
'transaction',
transactionQuery,
transactionsQuery,
Expand Down
Loading

0 comments on commit a25326c

Please sign in to comment.