Skip to content

Commit 157e702

Browse files
wrap in transaction
1 parent ed26aa8 commit 157e702

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

users/src/profile/delete.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ export async function deleteProfileHandler(req: Request, res: Response) {
1010
const uid = req.userToken.uid;
1111

1212
try {
13-
await em.nativeDelete(Profile, { uid: uid });
14-
await em.nativeDelete(Activity, { uid: uid });
13+
await em.transactional(async (manager) => {
14+
await manager.nativeDelete(Profile, { uid: uid });
15+
await manager.nativeDelete(Activity, { uid: uid });
16+
});
1517

1618
const response: ApiResponse = {
1719
statusMessage: {

0 commit comments

Comments
 (0)