Add userReport api
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user