Updated bulkDestroy method to handle model updates

refs https://github.com/TryGhost/Ghost/commit/1dd52075

- Fixes bulkDestroy being passed the context
- Fixes passing options.search to the model layer
- Updates return value since the changes in referenced commit
This commit is contained in:
Fabien O'Carroll 2021-08-13 13:23:01 +02:00
parent 7ee0df2ce6
commit 6540fd0cd0

View File

@ -305,12 +305,16 @@ module.exports = class MemberRepository {
filterOptions.transacting = options.transacting; filterOptions.transacting = options.transacting;
} }
if (options.context) {
filterOptions.context = options.context;
}
if (all !== true) { if (all !== true) {
if (filter) { if (filter) {
filterOptions.filter = filter; filterOptions.filter = filter;
} }
if (filter) { if (search) {
filterOptions.search = search; filterOptions.search = search;
} }
} }
@ -321,7 +325,13 @@ module.exports = class MemberRepository {
const memberIds = memberRows.map(row => row.id); const memberIds = memberRows.map(row => row.id);
return this._Member.bulkDestroy(memberIds); const bulkDestroyResult = await this._Member.bulkDestroy(memberIds);
bulkDestroyResult.unsuccessfulIds = bulkDestroyResult.unsuccessfulData;
delete bulkDestroyResult.unsuccessfulData;
return bulkDestroyResult;
} }
async upsertCustomer(data) { async upsertCustomer(data) {