mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
fix redis connection. fix delete account
This commit is contained in:
parent
12704c81e5
commit
afe6d8994b
2
.gitignore
vendored
2
.gitignore
vendored
@ -36,5 +36,5 @@ yarn-error.log*
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
*.development.yml
|
||||
*.dev.yml
|
||||
|
||||
|
@ -9,6 +9,10 @@ const INITIALIZED = 'redis:initialized';
|
||||
export const DELETED = 'deleted';
|
||||
|
||||
function getClient() {
|
||||
if (!process.env.REDIS_URL) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const redis = new Redis(process.env.REDIS_URL);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
|
@ -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({
|
||||
const websites = await client.website.findMany({
|
||||
where: { user_id },
|
||||
select: { website_uuid: true },
|
||||
})
|
||||
.map(a => a.website_uuid);
|
||||
});
|
||||
|
||||
let websiteUuids = [];
|
||||
|
||||
if (websites.length > 0) {
|
||||
websiteUuids = websites.map(a => a.website_uuid);
|
||||
}
|
||||
|
||||
return client
|
||||
.$transaction([
|
||||
|
Loading…
Reference in New Issue
Block a user