@directus/api
Version:
Directus is a real-time API and App dashboard for managing SQL database content
23 lines (22 loc) • 997 B
TypeScript
import type { Accountability, Item, PrimaryKey, Query, SchemaOverview } from '@directus/types';
import type { Knex } from 'knex';
export type AbstractServiceOptions = {
knex?: Knex | undefined;
accountability?: Accountability | null | undefined;
schema: SchemaOverview;
nested?: string[];
};
export interface AbstractService {
knex: Knex;
accountability: Accountability | null | undefined;
nested: string[];
createOne(data: Partial<Item>): Promise<PrimaryKey>;
createMany(data: Partial<Item>[]): Promise<PrimaryKey[]>;
readOne(key: PrimaryKey, query?: Query): Promise<Item>;
readMany(keys: PrimaryKey[], query?: Query): Promise<Item[]>;
readByQuery(query: Query): Promise<Item[]>;
updateOne(key: PrimaryKey, data: Partial<Item>): Promise<PrimaryKey>;
updateMany(keys: PrimaryKey[], data: Partial<Item>): Promise<PrimaryKey[]>;
deleteOne(key: PrimaryKey): Promise<PrimaryKey>;
deleteMany(keys: PrimaryKey[]): Promise<PrimaryKey[]>;
}