mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Add userReport api
This commit is contained in:
parent
de509e7ccc
commit
4df7d6a2a1
7 changed files with 189 additions and 2 deletions
|
|
@ -210,6 +210,20 @@ export async function deleteUser(
|
|||
},
|
||||
},
|
||||
}),
|
||||
client.userReport.deleteMany({
|
||||
where: {
|
||||
OR: [
|
||||
{
|
||||
websiteId: {
|
||||
in: websiteIds,
|
||||
},
|
||||
},
|
||||
{
|
||||
userId,
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
cloudMode
|
||||
? client.website.updateMany({
|
||||
data: {
|
||||
|
|
|
|||
37
queries/admin/userReport.ts
Normal file
37
queries/admin/userReport.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { Prisma, UserReport } from '@prisma/client';
|
||||
import prisma from 'lib/prisma';
|
||||
|
||||
export async function createUserReport(
|
||||
data: Prisma.UserReportUncheckedCreateInput,
|
||||
): Promise<UserReport> {
|
||||
return prisma.client.userReport.create({ data });
|
||||
}
|
||||
|
||||
export async function getUserReportById(userReportId: string): Promise<UserReport> {
|
||||
return prisma.client.userReport.findUnique({
|
||||
where: {
|
||||
id: userReportId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function getUserReports(userId: string): Promise<UserReport[]> {
|
||||
return prisma.client.userReport.findMany({
|
||||
where: {
|
||||
userId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateUserReport(
|
||||
data: Prisma.UserReportUpdateInput,
|
||||
where: Prisma.UserReportWhereUniqueInput,
|
||||
): Promise<UserReport> {
|
||||
return prisma.client.userReport.update({ data, where });
|
||||
}
|
||||
|
||||
export async function deleteUserReport(
|
||||
where: Prisma.UserReportWhereUniqueInput,
|
||||
): Promise<UserReport> {
|
||||
return prisma.client.userReport.delete({ where });
|
||||
}
|
||||
|
|
@ -92,6 +92,11 @@ export async function deleteWebsite(
|
|||
websiteId,
|
||||
},
|
||||
}),
|
||||
client.userReport.deleteMany({
|
||||
where: {
|
||||
websiteId,
|
||||
},
|
||||
}),
|
||||
cloudMode
|
||||
? prisma.client.website.update({
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
export * from './admin/team';
|
||||
export * from './admin/teamUser';
|
||||
export * from './admin/user';
|
||||
export * from './admin/userReport';
|
||||
export * from './admin/website';
|
||||
export * from './analytics/event/getEventMetrics';
|
||||
export * from './analytics/event/getEventUsage';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue