fix(api): fix new subscriptions not being saved to database
for some reason i forgot to set the field referenced by $addToSet to `body.push` lmao #justcopyandpastethings
This commit is contained in:
parent
4c9293ec19
commit
3a8fd82dae
@ -6,6 +6,7 @@ export default eventHandler(async (ev) => {
|
||||
isLoggedIn(ev);
|
||||
// note: debounced batched update
|
||||
const body = await readBody<SubPayload>(ev);
|
||||
console.log(body);
|
||||
await User.findByIdAndUpdate(ev.context.currentUser!._id, {
|
||||
$pull: {
|
||||
"subscriptions.authors": {
|
||||
@ -24,13 +25,13 @@ export default eventHandler(async (ev) => {
|
||||
{
|
||||
$addToSet: {
|
||||
"subscriptions.authors": {
|
||||
$each: body.pull?.authors ?? [],
|
||||
$each: body.push?.authors ?? [],
|
||||
},
|
||||
"subscriptions.bands": {
|
||||
$each: body.pull?.bands ?? [],
|
||||
$each: body.push?.bands ?? [],
|
||||
},
|
||||
"subscriptions.stories": {
|
||||
$each: body.pull?.stories ?? [],
|
||||
$each: body.push?.stories ?? [],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user