mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix(api): add deleteOne builtin protection
This commit is contained in:
parent
2f5c85cb64
commit
3ff2b97221
@ -555,8 +555,10 @@ export abstract class BaseRepository<
|
||||
}
|
||||
|
||||
async deleteOne(criteria: string | TFilterQuery<T>): Promise<DeleteResult> {
|
||||
const filter = typeof criteria === 'string' ? { _id: criteria } : criteria;
|
||||
|
||||
return await this.model
|
||||
.deleteOne(typeof criteria === 'string' ? { _id: criteria } : criteria)
|
||||
.deleteOne({ ...filter, builtin: { $ne: true } })
|
||||
.exec();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user