Skip to content

Commit

Permalink
Remove lines that would delete unchosen and rejected legacy profiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Antlion12 committed Dec 9, 2024
1 parent 64756c9 commit d6729db
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
1 change: 0 additions & 1 deletion apps/api/src/routes/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ export const usersRoutes =
}

if (rejected) {
await clearLegacyUser({ db, legacyProfile });
const [profile, socialAccounts, notificationSettings] =
await Promise.all([
db.userProfile.upsert({
Expand Down
22 changes: 0 additions & 22 deletions apps/api/src/utils/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,33 +374,11 @@ export const migrateLegacyUser = async ({
data: {
userId,
legacyProfileMigratedAt: new Date(),
// // Preserve legacy info for historical purposes.
// legacyAddress: null,
// legacyEmail: null,
// legacyEmailVerifiedAt: null,
},
select: USER_PROFILE_SELECT_FIELDS,
});
}

// Delete any other legacy records that weren't migrated
await db.$transaction([
db.userProfile.deleteMany({
where: {
legacyAddress: legacyProfile.legacyAddress,
},
}),
...(legacyProfile.email
? []
: [
db.userProfile.deleteMany({
where: {
legacyEmail: legacyProfile.legacyEmail,
},
}),
]),
]);

return {
updatedProfile,
updatedSocialAccounts,
Expand Down

0 comments on commit d6729db

Please sign in to comment.