Skip to content

Commit

Permalink
AbstractModelService: make plural configurable #10387
Browse files Browse the repository at this point in the history
A use case is when the query name is different than the type name
By default, will still make the plural from the singular query name
  • Loading branch information
stissot committed May 14, 2024
1 parent a9ee292 commit f675326
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion projects/natural/src/lib/services/abstract-model.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export abstract class NaturalAbstractModelService<
protected readonly createMutation: DocumentNode | null,
protected readonly updateMutation: DocumentNode | null,
protected readonly deleteMutation: DocumentNode | null,
protected readonly plural: string | null = null,
) {}

/**
Expand Down Expand Up @@ -482,7 +483,7 @@ export abstract class NaturalAbstractModelService<
* This is used for the unique validator
*/
public count(queryVariablesManager: NaturalQueryVariablesManager<Vall>): Observable<number> {
const plural = makePlural(this.name);
const plural = this.plural ?? makePlural(this.name);
const queryName = 'Count' + upperCaseFirstLetter(plural);
const filterType = upperCaseFirstLetter(this.name) + 'Filter';

Expand Down

0 comments on commit f675326

Please sign in to comment.