[ACS-7430] Make name optional in SortableByCategoryItem interface (#9735)

This commit is contained in:
MichalKinas
2024-05-27 12:45:27 +02:00
committed by GitHub
parent f2cfd683af
commit a1555074a7

View File

@@ -18,7 +18,7 @@
import { Injectable } from '@angular/core';
export interface SortableByCategoryItem {
name: string;
name?: string;
category?: string;
}
@@ -31,7 +31,6 @@ export interface ItemsByCategory<T> {
providedIn: 'root'
})
export class SortByCategoryMapperService<T extends SortableByCategoryItem = SortableByCategoryItem> {
private defaultCategories: string[] = [];
mapItems(items: T[], defaultCategories: string[]): ItemsByCategory<T>[] {
@@ -83,15 +82,14 @@ export class SortByCategoryMapperService<T extends SortableByCategoryItem = Sort
}
return itemA.category.localeCompare(itemB.category);
}
);
});
}
private mapItemDefaultCategory(listItem: SortableByCategoryItem): string {
const itemCategory = listItem.category;
if (!this.isDefaultCategory(itemCategory)) {
return (itemCategory ?? '');
return itemCategory ?? '';
}
return '';