Feat/um 62 prisma property names (#1562)

* checkpoint

* fix pg schema

* fix mysql schema

* change property names
This commit is contained in:
Brian Cao 2022-10-10 13:42:18 -07:00 committed by GitHub
parent 36edbe2f4c
commit 78338205a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 431 additions and 433 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,
},
}),
])