refactor(api): use null propagation for fields in subscription payload
This commit is contained in:
parent
088232f750
commit
50e860df5d
@ -9,13 +9,13 @@ export default eventHandler(async (ev) => {
|
||||
await User.findByIdAndUpdate(ev.context.currentUser!._id, {
|
||||
$pull: {
|
||||
"subscriptions.authors": {
|
||||
$in: body.pull.authors,
|
||||
$in: body.pull?.authors,
|
||||
},
|
||||
"subscriptions.bands": {
|
||||
$in: body.pull.bands,
|
||||
$in: body.pull?.bands ?? [],
|
||||
},
|
||||
"subscriptions.stories": {
|
||||
$in: body.pull.stories,
|
||||
$in: body.pull?.stories ?? [],
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -24,13 +24,13 @@ export default eventHandler(async (ev) => {
|
||||
{
|
||||
$addToSet: {
|
||||
"subscriptions.authors": {
|
||||
$each: body.pull.authors,
|
||||
$each: body.pull?.authors ?? [],
|
||||
},
|
||||
"subscriptions.bands": {
|
||||
$each: body.pull.bands,
|
||||
$each: body.pull?.bands ?? [],
|
||||
},
|
||||
"subscriptions.stories": {
|
||||
$each: body.pull.stories,
|
||||
$each: body.pull?.stories ?? [],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user