Skip to content

Commit 348f978

Browse files
committed
refactor: remove ...args in the controller
1 parent 176d39e commit 348f978

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/controller/mikro-crud-controller.class.ts

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ export abstract class MikroCrudController<
2020

2121
async list(
2222
{ limit, offset, order, filter, expand }: QueryParams<Entity>,
23-
user: any,
24-
...args: any[]
23+
user: any
2524
): Promise<unknown> {
2625
const { total, results } = await this.service.list({
2726
limit,
@@ -44,13 +43,12 @@ export abstract class MikroCrudController<
4443
async create(
4544
{ expand }: QueryParams<Entity>,
4645
data: CreateDto,
47-
user: any,
48-
...args: any[]
46+
user: any
4947
): Promise<unknown> {
5048
let entity = await this.service.create({ data, user });
5149
await this.service.save();
5250
entity = await this.service.retrieve({
53-
conditions: this.getPkCondition(entity),
51+
conditions: this.getPrimaryKey(entity),
5452
expand,
5553
refresh: true,
5654
user,
@@ -63,8 +61,7 @@ export abstract class MikroCrudController<
6361
async retrieve(
6462
lookup: Entity[LookupField],
6563
{ expand }: QueryParams<Entity>,
66-
user: any,
67-
...args: any[]
64+
user: any
6865
): Promise<unknown> {
6966
const conditions = { [this.lookupField]: lookup };
7067
const entity = await this.service
@@ -85,8 +82,7 @@ export abstract class MikroCrudController<
8582
lookup: Entity[LookupField],
8683
{ expand }: QueryParams<Entity>,
8784
data: CreateDto,
88-
user: any,
89-
...args: any[]
85+
user: any
9086
): Promise<unknown> {
9187
const conditions = { [this.lookupField]: lookup };
9288
let entity = await this.service
@@ -101,7 +97,7 @@ export abstract class MikroCrudController<
10197
await this.service.replace({ entity, data, user });
10298
await this.service.save();
10399
entity = await this.service.retrieve({
104-
conditions: this.getPkCondition(entity),
100+
conditions: this.getPrimaryKey(entity),
105101
expand,
106102
refresh: true,
107103
user,
@@ -115,8 +111,7 @@ export abstract class MikroCrudController<
115111
lookup: Entity[LookupField],
116112
{ expand }: QueryParams<Entity>,
117113
data: UpdateDto,
118-
user: any,
119-
...args: any[]
114+
user: any
120115
): Promise<unknown> {
121116
const conditions = { [this.lookupField]: lookup };
122117
let entity = await this.service
@@ -131,7 +126,7 @@ export abstract class MikroCrudController<
131126
await this.service.update({ entity, data, user });
132127
await this.service.save();
133128
entity = await this.service.retrieve({
134-
conditions: this.getPkCondition(entity),
129+
conditions: this.getPrimaryKey(entity),
135130
expand,
136131
refresh: true,
137132
user,
@@ -141,11 +136,7 @@ export abstract class MikroCrudController<
141136
return entity;
142137
}
143138

144-
async destroy(
145-
lookup: Entity[LookupField],
146-
user: any,
147-
...args: any[]
148-
): Promise<unknown> {
139+
async destroy(lookup: Entity[LookupField], user: any): Promise<unknown> {
149140
const conditions = { [this.lookupField]: lookup };
150141
const entity = await this.service
151142
.retrieve({ conditions, user })

0 commit comments

Comments
 (0)