Skip to content

Commit

Permalink
feat: make CRUD methods accept EntityData too
Browse files Browse the repository at this point in the history
  • Loading branch information
Char2sGu committed Jun 8, 2021
1 parent 845d803 commit a9100a2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/services/mikro-crud-service.interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EntityRepository, FindOptions } from "@mikro-orm/core";
import {
AnyEntity,
EntityData,
EntityMetadata,
FilterQuery,
NonFunctionPropertyNames,
Expand Down Expand Up @@ -33,7 +34,10 @@ export interface MikroCrudService<
user?: any;
}): Promise<{ total: number; results: Entity[] }>;

create(args: { data: CreateDto; user?: any }): Promise<Entity>;
create(args: {
data: CreateDto | EntityData<Entity>;
user?: any;
}): Promise<Entity>;

retrieve(args: {
conditions: FilterQuery<Entity>;
Expand All @@ -42,13 +46,13 @@ export interface MikroCrudService<

replace(args: {
entity: Entity;
data: CreateDto;
data: CreateDto | EntityData<Entity>;
user?: any;
}): Promise<Entity>;

update(args: {
entity: Entity;
data: UpdateDto;
data: UpdateDto | EntityData<Entity>;
user?: any;
}): Promise<Entity>;

Expand Down

0 comments on commit a9100a2

Please sign in to comment.