mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Fixed change password issue. API refactoring. Closes #1592.
This commit is contained in:
parent
994cf950c8
commit
ac070d3ce9
24 changed files with 74 additions and 111 deletions
|
|
@ -1,9 +0,0 @@
|
|||
import prisma from 'lib/prisma';
|
||||
|
||||
export async function getAccountById(userId) {
|
||||
return prisma.client.account.findUnique({
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import prisma from 'lib/prisma';
|
||||
|
||||
export async function getAccountByUsername(username) {
|
||||
return prisma.client.account.findUnique({
|
||||
where: {
|
||||
username,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -1,27 +1,24 @@
|
|||
import prisma from 'lib/prisma';
|
||||
import redis, { DELETED } from 'lib/redis';
|
||||
import { getWebsiteByUuid } from 'queries';
|
||||
|
||||
export async function deleteWebsite(websiteId) {
|
||||
export async function deleteWebsite(websiteUuid) {
|
||||
const { client, transaction } = prisma;
|
||||
|
||||
const { websiteUuid } = await getWebsiteByUuid(websiteId);
|
||||
|
||||
return transaction([
|
||||
client.pageview.deleteMany({
|
||||
where: { session: { website: { websiteUuid: websiteId } } },
|
||||
where: { session: { website: { websiteUuid } } },
|
||||
}),
|
||||
client.eventData.deleteMany({
|
||||
where: { event: { session: { website: { websiteUuid: websiteId } } } },
|
||||
where: { event: { session: { website: { websiteUuid } } } },
|
||||
}),
|
||||
client.event.deleteMany({
|
||||
where: { session: { website: { websiteUuid: websiteId } } },
|
||||
where: { session: { website: { websiteUuid } } },
|
||||
}),
|
||||
client.session.deleteMany({
|
||||
where: { website: { websiteUuid: websiteId } },
|
||||
where: { website: { websiteUuid } },
|
||||
}),
|
||||
client.website.delete({
|
||||
where: { websiteUuid: websiteId },
|
||||
where: { websiteUuid },
|
||||
}),
|
||||
]).then(async res => {
|
||||
if (redis.client) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,16 @@
|
|||
import prisma from 'lib/prisma';
|
||||
import redis from 'lib/redis';
|
||||
|
||||
export async function getWebsite(where) {
|
||||
return prisma.client.website.findUnique({
|
||||
where,
|
||||
});
|
||||
return prisma.client.website
|
||||
.findUnique({
|
||||
where,
|
||||
})
|
||||
.then(async data => {
|
||||
if (redis.enabled && data) {
|
||||
await redis.client.set(`website:${data.websiteUuid}`, data.id);
|
||||
}
|
||||
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
import prisma from 'lib/prisma';
|
||||
|
||||
export async function getWebsiteById(websiteId) {
|
||||
return prisma.client.website.findUnique({
|
||||
where: {
|
||||
id: websiteId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import prisma from 'lib/prisma';
|
||||
|
||||
export async function getWebsiteByShareId(shareId) {
|
||||
return prisma.client.website.findUnique({
|
||||
where: {
|
||||
shareId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
import prisma from 'lib/prisma';
|
||||
import redis from 'lib/redis';
|
||||
|
||||
export async function getWebsiteByUuid(websiteUuid) {
|
||||
return prisma.client.website
|
||||
.findUnique({
|
||||
where: {
|
||||
websiteUuid,
|
||||
},
|
||||
})
|
||||
.then(async res => {
|
||||
if (redis.client && res) {
|
||||
await redis.client.set(`website:${res.websiteUuid}`, res.id);
|
||||
}
|
||||
|
||||
return res;
|
||||
});
|
||||
}
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
export * from './admin/account/createAccount';
|
||||
export * from './admin/account/deleteAccount';
|
||||
export * from './admin/account/getAccount';
|
||||
export * from './admin/account/getAccountById';
|
||||
export * from './admin/account/getAccountByUsername';
|
||||
export * from './admin/account/getAccounts';
|
||||
export * from './admin/account/updateAccount';
|
||||
export * from './admin/website/createWebsite';
|
||||
|
|
@ -10,9 +8,6 @@ export * from './admin/website/deleteWebsite';
|
|||
export * from './admin/website/getAllWebsites';
|
||||
export * from './admin/website/getUserWebsites';
|
||||
export * from './admin/website/getWebsite';
|
||||
export * from './admin/website/getWebsiteById';
|
||||
export * from './admin/website/getWebsiteByShareId';
|
||||
export * from './admin/website/getWebsiteByUuid';
|
||||
export * from './admin/website/resetWebsite';
|
||||
export * from './admin/website/updateWebsite';
|
||||
export * from './analytics/event/getEventMetrics';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue