@minimaltech/ra-infra
Version:
Minimal Technology ReactJS Infrastructure
34 lines (33 loc) • 1.22 kB
TypeScript
import { EntityRelationType, ICrudService, IDataProvider, IdType } from '../../common';
import { Logger } from '../../helpers';
import { Filter, Where } from '@loopback/filter';
export interface ICrudServiceOptions {
basePath: string;
}
export declare class BaseCrudService<E extends {
id: IdType;
[extra: string | symbol]: any;
} = any> implements ICrudService<E> {
protected logger: Logger;
protected dataProvider: IDataProvider;
protected serviceOptions: ICrudServiceOptions;
constructor(opts: {
dataProvider: IDataProvider;
serviceOptions: ICrudServiceOptions;
});
find(filter: Filter<E>): Promise<(E & EntityRelationType)[]>;
findById(id: IdType, filter: Filter<E>): Promise<E & EntityRelationType>;
findOne(filter: Filter<E>): Promise<(E & EntityRelationType) | null>;
count(where: Where<E>): Promise<{
count: number;
}>;
create(data: Omit<E, 'id'>): Promise<E>;
updateAll(data: Partial<E>, where: Where<E>): Promise<{
count: number;
}>;
updateById(id: IdType, data: Partial<E>): Promise<E>;
replaceById(id: IdType, data: E): Promise<E>;
deleteById(id: IdType): Promise<{
id: IdType;
}>;
}