import type { Class } from '@travetto/runtime'; import type { ModelCrudSupport, ModelType } from '@travetto/model'; import type { ModelQuerySupport } from './query.ts'; import type { ModelQuery } from '../model/query.ts'; /** * The contract for a model service with query support * @concrete */ export interface ModelQueryCrudSupport extends ModelCrudSupport, ModelQuerySupport { /** * A standard update operation, but ensures the data matches the query before the update is finalized * @param cls The model class * @param data The data * @param query The additional query to validate */ updateByQuery(cls: Class, data: T, query: ModelQuery): Promise; /** * Update all with partial data, by query * @param cls The model class * @param query The query to search for * @param data The partial data */ updatePartialByQuery(cls: Class, query: ModelQuery, data: Partial): Promise; /** * Delete all by query * @param cls The model class * @param query Query to search for deletable elements */ deleteByQuery(cls: Class, query: ModelQuery): Promise; }