change property names

This commit is contained in:
Brian Cao 2022-10-10 10:45:05 -07:00
parent b69dfb366b
commit 2bd336d1c9
65 changed files with 293 additions and 298 deletions

View file

@ -1,40 +1,40 @@
import prisma from 'lib/prisma';
import redis, { DELETED } from 'lib/redis';
export async function deleteAccount(user_id) {
export async function deleteAccount(userId) {
const { client } = prisma;
const websites = await client.website.findMany({
where: { user_id },
select: { website_uuid: true },
where: { userId },
select: { websiteUuid: true },
});
let websiteUuids = [];
if (websites.length > 0) {
websiteUuids = websites.map(a => a.website_uuid);
websiteUuids = websites.map(a => a.websiteUuid);
}
return client
.$transaction([
client.pageview.deleteMany({
where: { session: { website: { user_id } } },
where: { session: { website: { userId } } },
}),
client.event_data.deleteMany({
where: { event: { session: { website: { user_id } } } },
client.eventData.deleteMany({
where: { event: { session: { website: { userId } } } },
}),
client.event.deleteMany({
where: { session: { website: { user_id } } },
where: { session: { website: { userId } } },
}),
client.session.deleteMany({
where: { website: { user_id } },
where: { website: { userId } },
}),
client.website.deleteMany({
where: { user_id },
where: { userId },
}),
client.account.delete({
where: {
user_id,
id: userId,
},
}),
])