Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
"use server";

import { db } from "@comp/db";
import { revalidatePath, revalidateTag } from "next/cache";
import { z } from "zod";
import { authActionClient } from "@/actions/safe-action";

const deleteControlSchema = z.object({
id: z.string(),
entityId: z.string(),
});

export const deleteControlAction = authActionClient
.schema(deleteControlSchema)
.metadata({
name: "delete-control",
track: {
event: "delete-control",
description: "Delete Control",
channel: "server",
},
})
.action(async ({ parsedInput, ctx }) => {
const { id } = parsedInput;
const { activeOrganizationId } = ctx.session;

if (!activeOrganizationId) {
return {
success: false,
error: "Not authorized",
};
}

try {
const control = await db.control.findUnique({
where: {
id,
organizationId: activeOrganizationId,
},
});

if (!control) {
return {
success: false,
error: "Control not found",
};
}

// Delete the control
await db.control.delete({
where: { id },
});

// Revalidate paths to update UI
revalidatePath(`/${activeOrganizationId}/controls/all`);
revalidatePath(`/${activeOrganizationId}/controls`);
revalidateTag("controls");

return {
success: true,
};
} catch (error) {
console.error(error);
return {
success: false,
error: "Failed to delete control",
};
}
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { deleteControlAction } from "@/app/(app)/(dashboard)/[orgId]/controls/[controlId]/actions/delete-control";
import { deleteControlAction } from "@/app/(app)/[orgId]/controls/[controlId]/actions/delete-control";
import { Control } from "@comp/db/types";
import { Button } from "@comp/ui/button";
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { auth } from "@/utils/auth";
import { db } from "@comp/db";
import { headers } from "next/headers";
import { redirect } from "next/navigation";
import PageWithBreadcrumb from "../../../../../../components/pages/PageWithBreadcrumb";
import PageWithBreadcrumb from "../../../../../components/pages/PageWithBreadcrumb";
import { getSingleFrameworkInstanceWithControls } from "../data/getSingleFrameworkInstanceWithControls";
import { FrameworkOverview } from "./components/FrameworkOverview";
import { FrameworkRequirements } from "./components/FrameworkRequirements";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { JSONContent } from "novel";
import {
Comments,
CommentWithAuthor,
} from "../../../../../../../components/comments/Comments";
} from "../../../../../../components/comments/Comments";
import { AuditLogWithRelations } from "../data";
import { PolicyPageEditor } from "../editor/components/PolicyDetails";
import { PolicyOverview } from "./PolicyOverview";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { cache } from "react";
import {
Comments,
CommentWithAuthor,
} from "../../../../../../components/comments/Comments";
} from "../../../../../components/comments/Comments";

interface PageProps {
searchParams: Promise<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import type { Attachment, Member, Task, User } from "@comp/db/types";
import { useMemo, useState } from "react";
import { CommentWithAuthor } from "../../../../../../../components/comments/Comments";
import { CommentWithAuthor } from "../../../../../../components/comments/Comments";
import { updateTask } from "../../actions/updateTask";
import { TaskDeleteDialog } from "./TaskDeleteDialog";
import { TaskMainContent } from "./TaskMainContent";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { useEffect, useState } from "react";
import { useDebouncedCallback } from "use-debounce";
import { updateTask } from "../../actions/updateTask";
import { TaskBody } from "./TaskBody";
import { CommentForm } from "../../../../../../../components/comments/CommentForm";
import { CommentList } from "../../../../../../../components/comments/CommentList";
import { CommentWithAuthor } from "../../../../../../../components/comments/Comments";
import { CommentForm } from "../../../../../../components/comments/CommentForm";
import { CommentList } from "../../../../../../components/comments/CommentList";
import { CommentWithAuthor } from "../../../../../../components/comments/Comments";

interface TaskMainContentProps {
task: Task & { fileUrls?: string[] };
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Departments, TaskFrequency, TaskStatus } from "@comp/db/types";

// Define possible statuses based on the Prisma schema
export const taskStatuses: TaskStatus[] = [
"todo",
"in_progress",
"done",
"not_relevant",
];

// Define possible frequencies
export const taskFrequencies: TaskFrequency[] = [
"daily",
"weekly",
"monthly",
"quarterly",
"yearly",
];

// Define possible departments
export const taskDepartments: Departments[] = [
"none",
"admin",
"gov",
"hr",
"it",
"itsm",
"qms",
];

// Define MAIN colors for Departments
export const DEPARTMENT_COLORS: Record<Departments, string> = {
none: "#6b7280", // Gray
admin: "#14b8a6", // Teal
gov: "#f97316", // Orange
hr: "#eab308", // Yellow
it: "#22c55e", // Green
itsm: "#3b82f6", // Blue
qms: "#a855f7", // Purple
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CommentEntityType, AttachmentEntityType } from "@comp/db/types";
import { headers } from "next/headers";
import { redirect } from "next/navigation";
import { SingleTask } from "./components/SingleTask";
import { CommentWithAuthor } from "../../../../../../components/comments/Comments";
import { CommentWithAuthor } from "../../../../../components/comments/Comments";

export default async function TaskPage({
params,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TaskStatus } from "@comp/db/types";
import { cn } from "@comp/ui/cn";
import { Check, Circle, Loader2 } from "lucide-react";
import { Check, Circle, CircleX, Loader2 } from "lucide-react";
import { STATUS_COLORS } from "@/components/status-indicator";

interface TaskStatusIndicatorProps {
Expand Down Expand Up @@ -49,6 +49,9 @@ export function TaskStatusIndicator({
{status === "done" && (
<Check className="size-4 text-[#00DC73]" strokeWidth={1.5} />
)}
{status === "not_relevant" && (
<CircleX className="size-4 text-[#ff0000]" strokeWidth={1.5} />
)}
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { InherentRiskForm } from "@/app/(app)/(dashboard)/[orgId]/vendors/[vendorId]/forms/risks/InherentRiskForm";
import { InherentRiskForm } from "@/app/(app)/[orgId]/vendors/[vendorId]/forms/risks/InherentRiskForm";
import { Button } from "@comp/ui/button";
import { Drawer, DrawerContent, DrawerTitle } from "@comp/ui/drawer";
import { useMediaQuery } from "@comp/ui/hooks";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { ResidualRiskForm } from "@/app/(app)/(dashboard)/[orgId]/vendors/[vendorId]/forms/risks/ResidualRiskForm";
import { ResidualRiskForm } from "@/app/(app)/[orgId]/vendors/[vendorId]/forms/risks/ResidualRiskForm";
import type { Vendor } from "@comp/db/types";
import { Button } from "@comp/ui/button";
import { Drawer, DrawerContent, DrawerTitle } from "@comp/ui/drawer";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { updateVendorInherentRisk } from "@/app/(app)/(dashboard)/[orgId]/vendors/[vendorId]/actions/update-vendor-inherent-risk";
import { updateVendorInherentRisk } from "@/app/(app)/[orgId]/vendors/[vendorId]/actions/update-vendor-inherent-risk";
import { Button } from "@comp/ui/button";
import {
Form,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { updateVendorResidualRisk } from "@/app/(app)/(dashboard)/[orgId]/vendors/[vendorId]/actions/update-vendor-residual-risk";
import { updateVendorResidualRisk } from "@/app/(app)/[orgId]/vendors/[vendorId]/actions/update-vendor-residual-risk";
import { Button } from "@comp/ui/button";
import {
Form,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { cache } from "react";
import {
Comments,
CommentWithAuthor,
} from "../../../../../../components/comments/Comments";
} from "../../../../../components/comments/Comments";
import { VendorInherentRiskChart } from "./components/VendorInherentRiskChart";
import { VendorResidualRiskChart } from "./components/VendorResidualRiskChart";
import { SecondaryFields } from "./components/secondary-fields/secondary-fields";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VendorOverview } from "@/app/(app)/(dashboard)/[orgId]/vendors/backup-overview/components/charts/vendor-overview";
import { VendorOverview } from "@/app/(app)/[orgId]/vendors/backup-overview/components/charts/vendor-overview";
import { getServersideSession } from "@/lib/get-session";
import type { Metadata } from "next";
import { headers } from "next/headers";
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/components/comments/CommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
import { toast } from "sonner";
import { useParams, useRouter } from "next/navigation";
import { createComment } from "@/actions/comments/createComment";
import { AttachmentItem } from "../../app/(app)/(dashboard)/[orgId]/tasks/[taskId]/components/AttachmentItem";
import { AttachmentItem } from "../../app/(app)/[orgId]/tasks/[taskId]/components/AttachmentItem";
import { Input } from "@comp/ui/input";

interface CommentFormProps {
Expand Down
4 changes: 2 additions & 2 deletions apps/app/src/components/comments/CommentItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import { deleteComment } from "@/actions/comments/deleteComment";
import { deleteCommentAttachment } from "@/actions/comments/deleteCommentAttachment";
import { getCommentAttachmentUrl } from "@/actions/comments/getCommentAttachmentUrl"; // Import action
import { updateComment } from "@/actions/comments/updateComment";
import { AttachmentItem } from "../../app/(app)/(dashboard)/[orgId]/tasks/[taskId]/components/AttachmentItem";
import { formatRelativeTime } from "../../app/(app)/(dashboard)/[orgId]/tasks/[taskId]/components/commentUtils"; // Revert import path
import { AttachmentItem } from "../../app/(app)/[orgId]/tasks/[taskId]/components/AttachmentItem";
import { formatRelativeTime } from "../../app/(app)/[orgId]/tasks/[taskId]/components/commentUtils"; // Revert import path
import { AttachmentEntityType } from "@comp/db/types"; // Import AttachmentEntityType
import type { AttachmentType } from "@comp/db/types";
import type { CommentWithAuthor } from "./Comments";
Expand Down
Loading
Loading