GitHub

DaffInMemoryBackendCategoryService

import { DaffInMemoryBackendCategoryService } from '@daffodil/category/driver/in-memory'

An in-memory service that mocks out the backend services for getting categories. See the angular in memory documentation for more details.

@Injectable()
class DaffInMemoryBackendCategoryService implements InMemoryDbService, DaffInMemorySingleRouteableBackend {
  readonly collectionName: "category" = DAFF_CATEGORY_IN_MEMORY_COLLECTION_NAME
  protected _root: DaffCategory
  protected _categories: DaffCategory[] = []
  protected _categoryPageMetadata: DaffCategoryPageMetadata
  get rootCategory(): DaffCategory
  get categories(): DaffCategory[]
  get categoryPageMetadata(): DaffCategoryPageMetadata

  get(reqInfo: any): any
  protected getTotalPages(
    allIds: string[]
    pageSize: number
  ): number
  protected trimProductIdsToSinglePage(
    allIds: any[]
    currentPage: number
    pageSize: number
  ): any[]
  protected generatePageSize(reqInfo): number
  protected getCurrentPageParam(reqInfo): number
}

Properties

collectionName
"category"
DefaultDAFF_CATEGORY_IN_MEMORY_COLLECTION_NAME
Description
_root
DaffCategory
Default
Description
_categories
DaffCategory[]
Default[]
Description
_categoryPageMetadata
DaffCategoryPageMetadata
Default
Description
rootCategory
DaffCategory
Default
Description
categories
DaffCategory[]
Default
Description

The collection of categories in the backend.

categoryPageMetadata
DaffCategoryPageMetadata
Default
Description

The metadata associated with the current page.

() Methods

get
any

Get a category.

Parameters
ParameterreqInfo: any
Description
getTotalPages
number
Parameters
ParameterallIds: string[]
Description
ParameterpageSize: number
Description
trimProductIdsToSinglePage
any[]
Parameters
ParameterallIds: any[]
Description
ParametercurrentPage: number
Description
ParameterpageSize: number
Description
generatePageSize
number
Parameters
ParameterreqInfo: undefined
Description
getCurrentPageParam
number
Parameters
ParameterreqInfo: undefined
Description