Break object deletions's dependency on schemaController
This commit is contained in:
@@ -173,11 +173,11 @@ export class MongoStorageAdapter {
|
|||||||
// If no objects match, reject with OBJECT_NOT_FOUND. If objects are found and deleted, resolve with undefined.
|
// If no objects match, reject with OBJECT_NOT_FOUND. If objects are found and deleted, resolve with undefined.
|
||||||
// If there is some other error, reject with INTERNAL_SERVER_ERROR.
|
// If there is some other error, reject with INTERNAL_SERVER_ERROR.
|
||||||
|
|
||||||
// Currently accepts the schemaController, and validate for lecacy reasons
|
// Currently accepts the validate for lecacy reasons. Currently accepts the schema, that may not actually be necessary.
|
||||||
deleteObjectsByQuery(className, query, schemaController, validate, parseFormatSchema) {
|
deleteObjectsByQuery(className, query, validate, schema) {
|
||||||
return this.adaptiveCollection(className)
|
return this.adaptiveCollection(className)
|
||||||
.then(collection => {
|
.then(collection => {
|
||||||
let mongoWhere = transform.transformWhere(className, query, { validate }, parseFormatSchema);
|
let mongoWhere = transform.transformWhere(className, query, { validate }, schema);
|
||||||
return collection.deleteMany(mongoWhere)
|
return collection.deleteMany(mongoWhere)
|
||||||
})
|
})
|
||||||
.then(({ result }) => {
|
.then(({ result }) => {
|
||||||
|
|||||||
@@ -337,13 +337,7 @@ DatabaseController.prototype.destroy = function(className, query, { acl } = {})
|
|||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
})
|
})
|
||||||
.then(parseFormatSchema => this.adapter.deleteObjectsByQuery(
|
.then(parseFormatSchema => this.adapter.deleteObjectsByQuery(className, query, !this.skipValidation, parseFormatSchema))
|
||||||
className,
|
|
||||||
query,
|
|
||||||
schemaController,
|
|
||||||
!this.skipValidation,
|
|
||||||
parseFormatSchema
|
|
||||||
))
|
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
// When deleting sessions while changing passwords, don't throw an error if they don't have any sessions.
|
// When deleting sessions while changing passwords, don't throw an error if they don't have any sessions.
|
||||||
if (className === "_Session" && error.code === Parse.Error.OBJECT_NOT_FOUND) {
|
if (className === "_Session" && error.code === Parse.Error.OBJECT_NOT_FOUND) {
|
||||||
|
|||||||
Reference in New Issue
Block a user