mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-25 02:36: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.test.local
|
||||||
.env.production.local
|
.env.production.local
|
||||||
|
|
||||||
*.development.yml
|
*.dev.yml
|
||||||
|
|
||||||
|
@ -9,6 +9,10 @@ const INITIALIZED = 'redis:initialized';
|
|||||||
export const DELETED = 'deleted';
|
export const DELETED = 'deleted';
|
||||||
|
|
||||||
function getClient() {
|
function getClient() {
|
||||||
|
if (!process.env.REDIS_URL) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const redis = new Redis(process.env.REDIS_URL);
|
const redis = new Redis(process.env.REDIS_URL);
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
|
@ -4,12 +4,16 @@ import redis, { DELETED } from 'lib/redis';
|
|||||||
export async function deleteAccount(user_id) {
|
export async function deleteAccount(user_id) {
|
||||||
const { client } = prisma;
|
const { client } = prisma;
|
||||||
|
|
||||||
const websiteUuids = await client.website
|
const websites = await client.website.findMany({
|
||||||
.findMany({
|
|
||||||
where: { user_id },
|
where: { user_id },
|
||||||
select: { website_uuid: true },
|
select: { website_uuid: true },
|
||||||
})
|
});
|
||||||
.map(a => a.website_uuid);
|
|
||||||
|
let websiteUuids = [];
|
||||||
|
|
||||||
|
if (websites.length > 0) {
|
||||||
|
websiteUuids = websites.map(a => a.website_uuid);
|
||||||
|
}
|
||||||
|
|
||||||
return client
|
return client
|
||||||
.$transaction([
|
.$transaction([
|
||||||
|
Loading…
Reference in New Issue
Block a user