feat: system admin blocklist table (#25039)
* feat: system admin blocklist table * chore: text * fix: type error * fix: type error * fix: type error * fix: frontend bug * chore: improvments * refactor: use shared components * refactor: improvements * fix: delete * refactor: support multiple watchlist * chore: update translation * fix: type err * fix: bulk bug * tests: add unit test * refactor: file * refactor: file * fix: type error * fix: type error * chore: translation * refactor: use shared comments * fix: imports * fix: type error
This commit is contained in:
1 parent
d865f6cb5f
commit
0330d14210
34 files changed
+1970
-633
No files matched your search
@@ -18,5 +18,6 @@ export const listReportsHandler = async ({ input }: ListReportsOptions) => {
|
||||
offset: input.offset,
|
||||
searchTerm: input.searchTerm,
|
||||
filters: input.filters,
|
||||
systemFilters: input.systemFilters,
|
||||
});
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { BookingReportReason, BookingReportStatus } from "@calcom/prisma/enums";
|
||||
import { BookingReportReason, BookingReportStatus, SystemReportStatus } from "@calcom/prisma/enums";
|
||||
|
||||
export const ZListReportsInputSchema = z.object({
|
||||
limit: z.number().min(1).max(100).default(25),
|
||||
@@ -12,6 +12,11 @@ export const ZListReportsInputSchema = z.object({
|
||||
reason: z.array(z.nativeEnum(BookingReportReason)).optional(),
|
||||
})
|
||||
.optional(),
|
||||
systemFilters: z
|
||||
.object({
|
||||
systemStatus: z.array(z.nativeEnum(SystemReportStatus)).optional(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export type TListReportsInputSchema = z.infer<typeof ZListReportsInputSchema>;
|
||||
+16
-1
@@ -2,7 +2,12 @@ import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
|
||||
import { PrismaBookingReportRepository } from "@calcom/features/bookingReport/repositories/PrismaBookingReportRepository";
|
||||
import { PermissionCheckService } from "@calcom/features/pbac/services/permission-check.service";
|
||||
import { MembershipRole, BookingReportReason, BookingReportStatus } from "@calcom/prisma/enums";
|
||||
import {
|
||||
MembershipRole,
|
||||
BookingReportReason,
|
||||
BookingReportStatus,
|
||||
SystemReportStatus,
|
||||
} from "@calcom/prisma/enums";
|
||||
|
||||
import { listBookingReportsHandler } from "./listBookingReports.handler";
|
||||
|
||||
@@ -29,7 +34,10 @@ describe("listBookingReportsHandler (Organization)", () => {
|
||||
cancelled: false,
|
||||
createdAt: new Date("2025-01-01"),
|
||||
status: BookingReportStatus.PENDING,
|
||||
systemStatus: SystemReportStatus.PENDING,
|
||||
watchlistId: null,
|
||||
globalWatchlistId: null,
|
||||
organizationId: 100,
|
||||
reporter: { id: 1, name: "Admin", email: "[email protected]" },
|
||||
booking: {
|
||||
id: 1,
|
||||
@@ -39,6 +47,8 @@ describe("listBookingReportsHandler (Organization)", () => {
|
||||
uid: "uid-1",
|
||||
},
|
||||
watchlist: null,
|
||||
globalWatchlist: null,
|
||||
organization: { id: 100, name: "Test Org", slug: "test-org" },
|
||||
},
|
||||
{
|
||||
id: "report-2",
|
||||
@@ -50,7 +60,10 @@ describe("listBookingReportsHandler (Organization)", () => {
|
||||
cancelled: true,
|
||||
createdAt: new Date("2025-01-02"),
|
||||
status: BookingReportStatus.BLOCKED,
|
||||
systemStatus: SystemReportStatus.PENDING,
|
||||
watchlistId: "watchlist-123",
|
||||
globalWatchlistId: null,
|
||||
organizationId: 100,
|
||||
reporter: { id: 1, name: "Admin", email: "[email protected]" },
|
||||
booking: {
|
||||
id: 2,
|
||||
@@ -66,6 +79,8 @@ describe("listBookingReportsHandler (Organization)", () => {
|
||||
action: "REPORT" as const,
|
||||
description: null,
|
||||
},
|
||||
globalWatchlist: null,
|
||||
organization: { id: 100, name: "Test Org", slug: "test-org" },
|
||||
},
|
||||
],
|
||||
meta: { totalRowCount: 2 },
|
||||
|
||||
Reference in new issue
Block a user