fix redis connection. fix delete account

This commit is contained in:
Brian Cao 2022-09-01 11:11:11 -07:00
parent 12704c81e5
commit afe6d8994b
3 changed files with 15 additions and 7 deletions

View file

@ -4,12 +4,16 @@ import redis, { DELETED } from 'lib/redis';
export async function deleteAccount(user_id) {
const { client } = prisma;
const websiteUuids = await client.website
.findMany({
where: { user_id },
select: { website_uuid: true },
})
.map(a => a.website_uuid);
const websites = await client.website.findMany({
where: { user_id },
select: { website_uuid: true },
});
let websiteUuids = [];
if (websites.length > 0) {
websiteUuids = websites.map(a => a.website_uuid);
}
return client
.$transaction([