Skip to content

Commit

Permalink
Remove user from session when marking it as deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikearaya committed Dec 20, 2024
1 parent 5d205c4 commit 5601170
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ export const configurePaymentCredentialsModule = (
_id
? generateDbFilterById(_id)
: {
userId,
paymentProviderId,
},
userId,
paymentProviderId,
},
{
$setOnInsert: {
_id: insertedId,
Expand Down
6 changes: 3 additions & 3 deletions packages/core-users/src/module/configureUsersModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,9 @@ export const configureUsersModule = async ({
},

markDeleted: async (userId: string): Promise<User> => {
await db.collection('sessions').deleteMany({
session: { $regex: `"user":"${userId}"` },
});
const user = await Users.findOneAndUpdate(
{ _id: userId },
{
Expand Down Expand Up @@ -659,9 +662,6 @@ export const configureUsersModule = async ({
},

deletePermanently: async ({ userId }: { userId: string }): Promise<User> => {
await db.collection('sessions').deleteMany({
session: { $regex: `"user":"${userId}"` },
});
return Users.findOneAndDelete({ _id: userId });
},

Expand Down
1 change: 0 additions & 1 deletion tests/products.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,6 @@ describe('Products', () => {
it('return minimum and maximum simulated price range of a configurable product', async () => {
const {
data: { product = {} },
...rest
} = await graphqlFetchAsAdmin({
query: /* GraphQL */ `
query simulatedPriceRange($productId: ID!) {
Expand Down

0 comments on commit 5601170

Please sign in to comment.