mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
delete this user pages in elastic
This commit is contained in:
parent
41f43b54ab
commit
322e135ead
1 changed files with 7 additions and 3 deletions
|
|
@ -1,13 +1,13 @@
|
|||
import {
|
||||
DeleteAccountSuccess,
|
||||
DeleteAccountError,
|
||||
DeleteAccountErrorCode,
|
||||
MutationDeleteAccountArgs,
|
||||
DeleteAccountSuccess,
|
||||
GoogleSignupResult,
|
||||
LoginErrorCode,
|
||||
LoginResult,
|
||||
LogOutErrorCode,
|
||||
LogOutResult,
|
||||
MutationDeleteAccountArgs,
|
||||
MutationGoogleLoginArgs,
|
||||
MutationGoogleSignupArgs,
|
||||
MutationLoginArgs,
|
||||
|
|
@ -39,6 +39,7 @@ import * as jwt from 'jsonwebtoken'
|
|||
import { createUser } from '../../services/create_user'
|
||||
import { comparePassword, hashPassword } from '../../utils/auth'
|
||||
import type { UserData } from '../../datalayer/user/model'
|
||||
import { deletePagesByParam } from '../../elastic/pages'
|
||||
|
||||
export const updateUserResolver = authorized<
|
||||
UpdateUserSuccess,
|
||||
|
|
@ -365,7 +366,7 @@ export const deleteAccountResolver = authorized<
|
|||
DeleteAccountSuccess,
|
||||
DeleteAccountError,
|
||||
MutationDeleteAccountArgs
|
||||
>(async (_, { userID }, { models, claims, log, authTrx }) => {
|
||||
>(async (_, { userID }, { models, claims, log, authTrx, pubsub }) => {
|
||||
const user = await models.user.get(userID)
|
||||
|
||||
if (!user) {
|
||||
|
|
@ -384,6 +385,9 @@ export const deleteAccountResolver = authorized<
|
|||
models.user.deleteUser(claims.uid, tx)
|
||||
)
|
||||
|
||||
// delete this user's pages in elastic
|
||||
await deletePagesByParam({ userId: userID }, { uid: userID, pubsub })
|
||||
|
||||
log.info('Deleting a user account', {
|
||||
userID,
|
||||
labels: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue