mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Use items service directly instead of super
Fixes callstack order problem, fixes #5538 pt 2
This commit is contained in:
@@ -128,6 +128,7 @@ router.patch(
|
||||
accountability: req.accountability,
|
||||
schema: req.schema,
|
||||
});
|
||||
|
||||
const primaryKey = await service.updateOne(req.accountability.user, req.body);
|
||||
const item = await service.readOne(primaryKey, req.sanitizedQuery);
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ export class UsersService extends ItemsService {
|
||||
async createOne(data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey> {
|
||||
const email = data.email.toLowerCase();
|
||||
await this.checkUniqueEmails([email]);
|
||||
return await super.createOne(data, opts);
|
||||
return await this.service.createOne(data, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,7 +124,7 @@ export class UsersService extends ItemsService {
|
||||
await this.checkPasswordPolicy(passwords);
|
||||
}
|
||||
|
||||
return await super.createMany(data, opts);
|
||||
return await this.service.createMany(data, opts);
|
||||
}
|
||||
|
||||
async updateOne(key: PrimaryKey, data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey> {
|
||||
@@ -142,7 +142,7 @@ export class UsersService extends ItemsService {
|
||||
throw new InvalidPayloadException(`You can't change the "tfa_secret" value manually.`);
|
||||
}
|
||||
|
||||
return await super.updateOne(key, data, opts);
|
||||
return await this.service.updateOne(key, data, opts);
|
||||
}
|
||||
|
||||
async updateMany(keys: PrimaryKey[], data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey[]> {
|
||||
@@ -160,7 +160,7 @@ export class UsersService extends ItemsService {
|
||||
throw new InvalidPayloadException(`You can't change the "tfa_secret" value manually.`);
|
||||
}
|
||||
|
||||
return await super.updateMany(keys, data, opts);
|
||||
return await this.service.updateMany(keys, data, opts);
|
||||
}
|
||||
|
||||
async updateByQuery(query: Query, data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey[]> {
|
||||
@@ -178,7 +178,7 @@ export class UsersService extends ItemsService {
|
||||
throw new InvalidPayloadException(`You can't change the "tfa_secret" value manually.`);
|
||||
}
|
||||
|
||||
return await super.updateByQuery(query, data, opts);
|
||||
return await this.service.updateByQuery(query, data, opts);
|
||||
}
|
||||
|
||||
async deleteOne(key: PrimaryKey, opts?: MutationOptions): Promise<PrimaryKey> {
|
||||
@@ -197,7 +197,7 @@ export class UsersService extends ItemsService {
|
||||
throw new UnprocessableEntityException(`You can't delete the last admin user.`);
|
||||
}
|
||||
|
||||
await super.deleteOne(key, opts);
|
||||
await this.service.deleteOne(key, opts);
|
||||
|
||||
return key;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ export class UsersService extends ItemsService {
|
||||
throw new UnprocessableEntityException(`You can't delete the last admin user.`);
|
||||
}
|
||||
|
||||
await super.deleteMany(keys, opts);
|
||||
await this.service.deleteMany(keys, opts);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user