Revert "chore: delete req.transactionID when committing payload operations"
This reverts commit 8e4cede62c.
This commit is contained in:
@@ -152,10 +152,7 @@ async function forgotPassword(incomingArgs: Arguments): Promise<null | string> {
|
||||
result: token,
|
||||
})
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return token
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -265,10 +265,7 @@ async function login<TSlug extends keyof GeneratedTypes['collections']>(
|
||||
// Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -86,10 +86,7 @@ async function registerFirstUser<TSlug extends keyof GeneratedTypes['collections
|
||||
token,
|
||||
}
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return {
|
||||
message: 'Registered and logged in successfully. Welcome!',
|
||||
|
||||
@@ -122,10 +122,7 @@ async function resetPassword(args: Arguments): Promise<Result> {
|
||||
overrideAccess,
|
||||
req,
|
||||
})
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return {
|
||||
token: collectionConfig.auth.removeTokenFromResponses ? undefined : token,
|
||||
|
||||
@@ -72,10 +72,7 @@ async function unlock(args: Args): Promise<boolean> {
|
||||
result = null
|
||||
}
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -405,10 +405,7 @@ async function create<TSlug extends keyof GeneratedTypes['collections']>(
|
||||
// Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -271,10 +271,7 @@ async function deleteOperation<TSlug extends keyof GeneratedTypes['collections']
|
||||
result,
|
||||
})
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -220,10 +220,7 @@ async function deleteByID<TSlug extends keyof GeneratedTypes['collections']>(
|
||||
// 8. Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -257,10 +257,7 @@ async function find<T extends TypeWithID & Record<string, unknown>>(
|
||||
// Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -205,10 +205,7 @@ async function findByID<T extends TypeWithID>(incomingArgs: Arguments): Promise<
|
||||
// Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -135,10 +135,7 @@ async function findVersionByID<T extends TypeWithID = any>(
|
||||
// Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -166,10 +166,7 @@ async function findVersions<T extends TypeWithVersion<T>>(
|
||||
docs: result.docs.map((doc) => sanitizeInternalFields<T>(doc)),
|
||||
}
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -190,10 +190,7 @@ async function restoreVersion<T extends TypeWithID = any>(args: Arguments): Prom
|
||||
})) || result
|
||||
}, Promise.resolve())
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -404,10 +404,7 @@ async function update<TSlug extends keyof GeneratedTypes['collections']>(
|
||||
result,
|
||||
})
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -375,10 +375,7 @@ async function updateByID<TSlug extends keyof GeneratedTypes['collections']>(
|
||||
// Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -120,10 +120,7 @@ async function findOne<T extends Record<string, unknown>>(args: Args): Promise<T
|
||||
// Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
// /////////////////////////////////////
|
||||
// Return results
|
||||
|
||||
@@ -126,10 +126,7 @@ async function findVersionByID<T extends TypeWithVersion<T> = any>(args: Argumen
|
||||
// Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -133,10 +133,7 @@ async function findVersions<T extends TypeWithVersion<T>>(
|
||||
docs: result.docs.map((doc) => sanitizeInternalFields<T>(doc)),
|
||||
}
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -149,10 +149,7 @@ async function restoreVersion<T extends TypeWithVersion<T> = any>(args: Argument
|
||||
})) || result
|
||||
}, Promise.resolve())
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
@@ -260,10 +260,7 @@ async function update<TSlug extends keyof GeneratedTypes['globals']>(
|
||||
// Return results
|
||||
// /////////////////////////////////////
|
||||
|
||||
if (shouldCommit) {
|
||||
await payload.db.commitTransaction(req.transactionID)
|
||||
delete req.transactionID
|
||||
}
|
||||
if (shouldCommit) await payload.db.commitTransaction(req.transactionID)
|
||||
|
||||
return result
|
||||
} catch (error: unknown) {
|
||||
|
||||
Reference in New Issue
Block a user