graycoreio/daffodil

View on GitHub
libs/core/src/collection/collection.interface.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { DaffCollectionMetadata } from './metadata.interface';
import { DaffIdentifiable } from '../identifiable/identifiable.interface';

/**
 * A collection of items that is paginable, sortable, and filterable.
 */
export interface DaffCollection<T extends DaffIdentifiable = DaffIdentifiable> {
  /**
   * The collection metadata that contains info about the collection.
   * Includes page, sorting, filtering, and total number of items.
   */
  metadata: DaffCollectionMetadata;
  /**
   * The current page of items according to the sorting and filtering.
   */
  data: Record<T['id'], T>;
}