3
3
How the softDelete2 hook is to be positioned relative to other possible hooks:
4
4
5
5
before: {
6
- // Add { deletedAt: { $eq: -1 } } to params.query.
6
+ // Add { deletedAt: -1 } to params.query.
7
7
find: [...hooks1, softDelete(), ...hooks2],
8
8
// Add { deletedAt: -1 } to the (array of) data objects.
9
9
// Existing deletedAt props will not be overridden if options.keepOnCreate = true.
19
19
// before: softDelete2() is a no-op. after: softDelete2() throws if record is marked deleted.
20
20
get: [...hooks1, softDelete({ skipProbeOnGet: true }), ...hooks2], // options.skipProbeOnGet: true
21
21
// If context.id provided: throw if record is deleted, else continue.
22
- // If not provided: add { deletedAt: { $eq: -1 } } to params.query.
22
+ // If not provided: add { deletedAt: -1 } to params.query.
23
23
patch: [...hooks1, softDelete(), ...hooks2],
24
24
// If context.id provided: throw if record is deleted.
25
- // If not provided: add { deletedAt: { $eq: -1 } } to params.query.
25
+ // If not provided: add { deletedAt: -1 } to params.query.
26
26
// Then in both cases: perform a removing patch call. On this removing patch call
27
27
// - before hooks positioned before softDelete will be run.
28
28
// - before hooks positioned after softDelete will not be run.
@@ -110,7 +110,7 @@ module.exports = function (options = {}) {
110
110
111
111
switch ( method ) {
112
112
case 'find' :
113
- context . params . query = addField ( context . params . query , deletedAt , { $eq : - 1 } ) ;
113
+ context . params . query = addField ( context . params . query , deletedAt , - 1 ) ;
114
114
return context ;
115
115
case 'create' :
116
116
const data = context . data ;
@@ -134,13 +134,13 @@ module.exports = function (options = {}) {
134
134
return context ;
135
135
}
136
136
137
- context . params . query = addField ( context . params . query , deletedAt , { $eq : - 1 } ) ;
137
+ context . params . query = addField ( context . params . query , deletedAt , - 1 ) ;
138
138
return context ;
139
139
case 'remove' :
140
140
if ( hasId ) {
141
141
await getActiveRecord ( options , context ) ;
142
142
} else {
143
- context . params . query = addField ( context . params . query , deletedAt , { $eq : - 1 } ) ;
143
+ context . params . query = addField ( context . params . query , deletedAt , - 1 ) ;
144
144
}
145
145
146
146
context . result = await patchCall ( context , options ) ;
0 commit comments