Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
feat(jobs): add notes to job applications
Khuram Niaz19a2b0f3fd95
diff --git a/package-lock.json b/package-lock.jsonindex f34607f..04d88de 100644--- a/package-lock.json+++ b/package-lock.json@@ -19,6 +19,7 @@"@radix-ui/react-accordion": "^1.2.12","@radix-ui/react-alert-dialog": "^1.1.3","@radix-ui/react-avatar": "^1.1.2",+ "@radix-ui/react-collapsible": "^1.1.12","@radix-ui/react-dialog": "^1.1.3","@radix-ui/react-dropdown-menu": "^2.1.3","@radix-ui/react-label": "^2.1.1",diff --git a/package.json b/package.jsonindex 36271d9..2f92e42 100644--- a/package.json+++ b/package.json@@ -23,6 +23,7 @@"@radix-ui/react-accordion": "^1.2.12","@radix-ui/react-alert-dialog": "^1.1.3","@radix-ui/react-avatar": "^1.1.2",+ "@radix-ui/react-collapsible": "^1.1.12","@radix-ui/react-dialog": "^1.1.3","@radix-ui/react-dropdown-menu": "^2.1.3","@radix-ui/react-label": "^2.1.1",diff --git a/prisma/migrations/20260302223041_add_note_model/migration.sql b/prisma/migrations/20260302223041_add_note_model/migration.sqlnew file mode 100644index 0000000..0c9157c--- /dev/null+++ b/prisma/migrations/20260302223041_add_note_model/migration.sql@@ -0,0 +1,17 @@+-- CreateTable+CREATE TABLE "Note" (+ "id" TEXT NOT NULL PRIMARY KEY,+ "jobId" TEXT NOT NULL,+ "userId" TEXT NOT NULL,+ "content" TEXT NOT NULL,+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,+ "updatedAt" DATETIME NOT NULL,+ CONSTRAINT "Note_jobId_fkey" FOREIGN KEY ("jobId") REFERENCES "Job" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "Note_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE+);++-- CreateIndex+CREATE INDEX "Note_jobId_idx" ON "Note"("jobId");++-- CreateIndex+CREATE INDEX "Note_userId_idx" ON "Note"("userId");diff --git a/prisma/schema.prisma b/prisma/schema.prismaindex d7436a1..b968b38 100644--- a/prisma/schema.prisma+++ b/prisma/schema.prisma@@ -31,6 +31,7 @@ model User {Automation Automation[]Settings UserSettings?ApiKey ApiKey[]+ Note Note[]}model ApiKey {@@ -282,6 +283,7 @@ model Job {Interview Interview[]Resume Resume? @relation(fields: [resumeId], references: [id])resumeId String?+ Notes Note[]// Automation discovery fieldsautomationId String?@@ -406,3 +408,17 @@ model AutomationRun {@@index([automationId])@@index([startedAt])}++model Note {+ id String @id @default(uuid())+ jobId String+ job Job @relation(fields: [jobId], references: [id], onDelete: Cascade)+ userId String+ user User @relation(fields: [userId], references: [id])+ content String+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt++ @@index([jobId])+ @@index([userId])+}diff --git a/src/actions/job.actions.ts b/src/actions/job.actions.tsindex cff295a..28a740e 100644--- a/src/actions/job.actions.ts+++ b/src/actions/job.actions.ts@@ -94,6 +94,7 @@ export const getJobsList = async (description: false,Resume: true,matchScore: true,+ _count: { select: { Notes: true } },},orderBy: {createdAt: "desc",diff --git a/src/actions/note.actions.ts b/src/actions/note.actions.tsnew file mode 100644index 0000000..8b1dcb7--- /dev/null+++ b/src/actions/note.actions.ts@@ -0,0 +1,121 @@+"use server";+import prisma from "@/lib/db";+import { handleError } from "@/lib/utils";+import { NoteFormSchema } from "@/models/note.schema";+import { NoteResponse } from "@/models/note.model";+import { getCurrentUser } from "@/utils/user.utils";+import { z } from "zod";++export const getNotesByJobId = async (+ jobId: string+): Promise<any | undefined> => {+ try {+ const user = await getCurrentUser();+ if (!user) {+ throw new Error("Not authenticated");+ }++ const job = await prisma.job.findFirst({+ where: { id: jobId, userId: user.id },+ select: { id: true },+ });+ if (!job) {+ throw new Error("Job not found");+ }++ const notes = await prisma.note.findMany({+ where: { jobId, userId: user.id },+ orderBy: { createdAt: "desc" },+ });++ const data: NoteResponse[] = notes.map((note) => ({+ ...note,+ isEdited: note.updatedAt.getTime() - note.createdAt.getTime() > 1000,+ }));++ return { success: true, data };+ } catch (error) {+ const msg = "Failed to fetch notes.";+ return handleError(error, msg);+ }+};++export const addNote = async (+ data: z.infer<typeof NoteFormSchema>+): Promise<any | undefined> => {+ try {+ const user = await getCurrentUser();+ if (!user) {+ throw new Error("Not authenticated");+ }++ const validated = NoteFormSchema.parse(data);++ const job = await prisma.job.findFirst({+ where: { id: validated.jobId, userId: user.id },+ select: { id: true },+ });+ if (!job) {+ throw new Error("Job not found");+ }++ const note = await prisma.note.create({+ data: {+ jobId: validated.jobId,+ userId: user.id,+ content: validated.content,+ },+ });++ return { success: true, data: note };+ } catch (error) {+ const msg = "Failed to add note.";+ return handleError(error, msg);+ }+};++export const updateNote = async (+ data: z.infer<typeof NoteFormSchema>+): Promise<any | undefined> => {+ try {+ const user = await getCurrentUser();+ if (!user) {+ throw new Error("Not authenticated");+ }++ const validated = NoteFormSchema.parse(data);+ if (!validated.id) {+ throw new Error("Note ID is required for update");+ }++ const note = await prisma.note.update({+ where: { id: validated.id, userId: user.id },+ data: { content: validated.content },+ });++ return { success: true, data: note };+ } catch (error) {+ const msg = "Failed to update note.";+ return handleError(error, msg);+ }+};++export const deleteNote = async (+ noteId: string+): Promise<any | undefined> => {+ try {+ const user = await getCurrentUser();+ if (!user) {+ throw new Error("Not authenticated");+ }++ await prisma.note.delete({+ where: { id: noteId, userId: user.id },+ });++ return { success: true };+ } catch (error) {+ const msg = "Failed to delete note.";+ return handleError(error, msg);+ }+};diff --git a/src/components/myjobs/AddJob.tsx b/src/components/myjobs/AddJob.tsxindex ef2a503..4ace990 100644--- a/src/components/myjobs/AddJob.tsx+++ b/src/components/myjobs/AddJob.tsx@@ -43,6 +43,7 @@ import { Input } from "../ui/input";import { Switch } from "../ui/switch";import { redirect } from "next/navigation";import { Combobox } from "../ComboBox";+import { NotesCollapsibleSection } from "./NotesCollapsibleSection";import { Resume } from "@/models/profile.model";import CreateResume from "../profile/CreateResume";import { getResumeList } from "@/actions/profile.actions";@@ -492,6 +493,9 @@ export function AddJob({)}/></div>+ {editJob && (+ <NotesCollapsibleSection jobId={editJob.id} />+ )}<div className="md:col-span-2"><DialogFooter// className="md:col-spandiff --git a/src/components/myjobs/JobDetails.tsx b/src/components/myjobs/JobDetails.tsxindex 30f6446..7d4f141 100644--- a/src/components/myjobs/JobDetails.tsx+++ b/src/components/myjobs/JobDetails.tsx@@ -15,6 +15,7 @@ import { Button } from "../ui/button";import { ArrowLeft, Sparkles } from "lucide-react";import { useRouter } from "next/navigation";import { AiJobMatchSection } from "../profile/AiJobMatchSection";+import { NotesSection } from "./NotesSection";import { useState, useMemo } from "react";import { DownloadFileButton } from "../profile/DownloadFileButton";import { MatchDetails } from "../automations/MatchDetails";@@ -120,6 +121,7 @@ function JobDetails({ job }: { job: JobResponse }) {<div className="my-4 ml-4"><TipTapContentViewer content={job?.description} /></div>+ <NotesSection jobId={job.id} />{parsedMatchData && (<div className="mx-4 mb-4"><h4 className="font-medium mb-2 flex items-center gap-2">diff --git a/src/components/myjobs/JobsContainer.tsx b/src/components/myjobs/JobsContainer.tsxindex 55875d3..f94a3ff 100644--- a/src/components/myjobs/JobsContainer.tsx+++ b/src/components/myjobs/JobsContainer.tsx@@ -40,6 +40,7 @@ import Loading from "../Loading";import { usePathname, useRouter, useSearchParams } from "next/navigation";import { AddJob } from "./AddJob";import MyJobsTable from "./MyJobsTable";+import { NoteDialog } from "./NoteDialog";import { format } from "date-fns";import { RecordsPerPageSelector } from "../RecordsPerPageSelector";import { RecordsCount } from "../RecordsCount";@@ -81,6 +82,8 @@ function JobsContainer({const [recordsPerPage, setRecordsPerPage] = useState<number>(APP_CONSTANTS.RECORDS_PER_PAGE,);+ const [noteDialogOpen, setNoteDialogOpen] = useState(false);+ const [noteJobId, setNoteJobId] = useState("");const hasSearched = useRef(false);const jobsPerPage = recordsPerPage;@@ -171,6 +174,11 @@ function JobsContainer({setEditJob(null);};+ const onAddNote = (jobId: string) => {+ setNoteJobId(jobId);+ setNoteDialogOpen(true);+ };+useEffect(() => {(async () => await loadJobs(1))();}, [loadJobs]);@@ -299,6 +307,7 @@ function JobsContainer({deleteJob={onDeleteJob}editJob={onEditJob}onChangeJobStatus={onChangeJobStatus}+ onAddNote={onAddNote}/><div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mt-4"><RecordsCount@@ -331,6 +340,12 @@ function JobsContainer({</CardContent><CardFooter></CardFooter></Card>+ <NoteDialog+ open={noteDialogOpen}+ onOpenChange={setNoteDialogOpen}+ jobId={noteJobId}+ onSaved={() => reloadJobs()}+ /></>);}diff --git a/src/components/myjobs/MyJobsTable.tsx b/src/components/myjobs/MyJobsTable.tsxindex cc14000..399d6d0 100644--- a/src/components/myjobs/MyJobsTable.tsx+++ b/src/components/myjobs/MyJobsTable.tsx@@ -11,6 +11,7 @@ import {ListCollapse,MoreHorizontal,Pencil,+ StickyNote,Tags,Trash,} from "lucide-react";@@ -43,6 +44,7 @@ type MyJobsTableProps = {deleteJob: (id: string) => void;editJob: (id: string) => void;onChangeJobStatus: (id: string, status: JobStatus) => void;+ onAddNote: (jobId: string) => void;};function MyJobsTable({@@ -51,6 +53,7 @@ function MyJobsTable({deleteJob,editJob,onChangeJobStatus,+ onAddNote,}: MyJobsTableProps) {const [alertOpen, setAlertOpen] = useState(false);const [jobIdToDelete, setJobIdToDelete] = useState("");@@ -103,9 +106,17 @@ function MyJobsTable({<TableCellclassName="font-medium cursor-pointer max-w-[120px] sm:max-w-none">- <Link href={`/dashboard/myjobs/${job?.id}`} className="block truncate">- {job.JobTitle?.label}- </Link>+ <div className="flex items-center gap-1.5">+ <Link href={`/dashboard/myjobs/${job?.id}`} className="block truncate">+ {job.JobTitle?.label}+ </Link>+ {(job._count?.Notes ?? 0) > 0 && (+ <Badge variant="secondary" className="text-xs px-1.5 py-0 h-5 shrink-0">+ <StickyNote className="h-3 w-3 mr-0.5" />+ {job._count!.Notes}+ </Badge>+ )}+ </div></TableCell><TableCell className="font-medium max-w-[100px] sm:max-w-none"><span className="block truncate">{job.Company?.label}</span>@@ -164,6 +175,13 @@ function MyJobsTable({<Pencil className="mr-2 h-4 w-4" />Edit Job</DropdownMenuItem>+ <DropdownMenuItem+ className="cursor-pointer"+ onClick={() => onAddNote(job.id)}+ >+ <StickyNote className="mr-2 h-4 w-4" />+ Add a Note+ </DropdownMenuItem><DropdownMenuSeparator /><DropdownMenuSub><DropdownMenuSubTrigger>diff --git a/src/components/myjobs/NoteCard.tsx b/src/components/myjobs/NoteCard.tsxnew file mode 100644index 0000000..657c4ad--- /dev/null+++ b/src/components/myjobs/NoteCard.tsx@@ -0,0 +1,46 @@+"use client";+import { NoteResponse } from "@/models/note.model";+import { TipTapContentViewer } from "../TipTapContentViewer";+import { format } from "date-fns";+import { Button } from "../ui/button";+import { Pencil, Trash } from "lucide-react";++type NoteCardProps = {+ note: NoteResponse;+ onEdit: (note: NoteResponse) => void;+ onDelete: (noteId: string) => void;+};++export function NoteCard({ note, onEdit, onDelete }: NoteCardProps) {+ return (+ <div className="border rounded-lg p-4 space-y-2">+ <div className="flex items-center justify-between">+ <div className="text-sm text-muted-foreground">+ {format(new Date(note.createdAt), "PPp")}+ {note.isEdited && (+ <span className="ml-2 text-xs text-muted-foreground">(edited)</span>+ )}+ </div>+ <div className="flex gap-1">+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7"+ onClick={() => onEdit(note)}+ >+ <Pencil className="h-3.5 w-3.5" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 text-destructive"+ onClick={() => onDelete(note.id)}+ >+ <Trash className="h-3.5 w-3.5" />+ </Button>+ </div>+ </div>+ <TipTapContentViewer content={note.content} />+ </div>+ );+}diff --git a/src/components/myjobs/NoteDialog.tsx b/src/components/myjobs/NoteDialog.tsxnew file mode 100644index 0000000..63979c0--- /dev/null+++ b/src/components/myjobs/NoteDialog.tsx@@ -0,0 +1,125 @@+"use client";+import {+ Dialog,+ DialogContent,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from "@/components/ui/dialog";+import { Button } from "../ui/button";+import { useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { z } from "zod";+import { NoteFormSchema } from "@/models/note.schema";+import { NoteResponse } from "@/models/note.model";+import { addNote, updateNote } from "@/actions/note.actions";+import { toast } from "../ui/use-toast";+import { useEffect, useTransition } from "react";+import { Loader } from "lucide-react";+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormMessage,+} from "../ui/form";+import TiptapEditor from "../TiptapEditor";++type NoteDialogProps = {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ jobId: string;+ editNote?: NoteResponse | null;+ onSaved: () => void;+};++export function NoteDialog({+ open,+ onOpenChange,+ jobId,+ editNote,+ onSaved,+}: NoteDialogProps) {+ const [isPending, startTransition] = useTransition();++ const form = useForm<z.infer<typeof NoteFormSchema>>({+ resolver: zodResolver(NoteFormSchema) as any,+ defaultValues: {+ jobId,+ content: "",+ },+ });++ useEffect(() => {+ if (editNote) {+ form.reset({ id: editNote.id, jobId, content: editNote.content });+ } else {+ form.reset({ jobId, content: "" });+ }+ }, [editNote, jobId, form, open]);++ function onSubmit(data: z.infer<typeof NoteFormSchema>) {+ startTransition(async () => {+ const result = editNote+ ? await updateNote(data)+ : await addNote(data);++ if (result.success) {+ toast({+ variant: "success",+ description: `Note ${editNote ? "updated" : "added"} successfully`,+ });+ form.reset({ jobId, content: "" });+ onOpenChange(false);+ onSaved();+ } else {+ toast({+ variant: "destructive",+ title: "Error!",+ description: result.message,+ });+ }+ });+ }++ return (+ <Dialog open={open} onOpenChange={onOpenChange}>+ <DialogContent className="sm:max-w-[600px] max-h-[80vh] overflow-y-auto">+ <DialogHeader>+ <DialogTitle>{editNote ? "Edit Note" : "Add Note"}</DialogTitle>+ </DialogHeader>+ <Form {...form}>+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">+ <FormField+ control={form.control}+ name="content"+ render={({ field }) => (+ <FormItem>+ <FormControl>+ <TiptapEditor field={field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ <DialogFooter>+ <Button+ type="button"+ variant="outline"+ onClick={() => onOpenChange(false)}+ >+ Cancel+ </Button>+ <Button type="submit" disabled={isPending}>+ Save+ {isPending && (+ <Loader className="ml-2 h-4 w-4 shrink-0 spinner" />+ )}+ </Button>+ </DialogFooter>+ </form>+ </Form>+ </DialogContent>+ </Dialog>+ );+}diff --git a/src/components/myjobs/NotesCollapsibleSection.tsx b/src/components/myjobs/NotesCollapsibleSection.tsxnew file mode 100644index 0000000..4831051--- /dev/null+++ b/src/components/myjobs/NotesCollapsibleSection.tsx@@ -0,0 +1,136 @@+"use client";+import { useCallback, useEffect, useState } from "react";+import { NoteResponse } from "@/models/note.model";+import { getNotesByJobId, deleteNote } from "@/actions/note.actions";+import { NoteCard } from "./NoteCard";+import { NoteDialog } from "./NoteDialog";+import { DeleteAlertDialog } from "../DeleteAlertDialog";+import { Button } from "../ui/button";+import { Badge } from "../ui/badge";+import { ChevronDown, PlusCircle, StickyNote } from "lucide-react";+import {+ Collapsible,+ CollapsibleContent,+ CollapsibleTrigger,+} from "../ui/collapsible";+import { toast } from "../ui/use-toast";++type NotesCollapsibleSectionProps = {+ jobId: string;+};++export function NotesCollapsibleSection({ jobId }: NotesCollapsibleSectionProps) {+ const [notes, setNotes] = useState<NoteResponse[]>([]);+ const [isOpen, setIsOpen] = useState(false);+ const [dialogOpen, setDialogOpen] = useState(false);+ const [editNote, setEditNote] = useState<NoteResponse | null>(null);+ const [deleteAlertOpen, setDeleteAlertOpen] = useState(false);+ const [noteIdToDelete, setNoteIdToDelete] = useState("");++ const loadNotes = useCallback(async () => {+ const result = await getNotesByJobId(jobId);+ if (result.success) {+ setNotes(result.data);+ }+ }, [jobId]);++ useEffect(() => {+ loadNotes();+ }, [loadNotes]);++ const handleEdit = (note: NoteResponse) => {+ setEditNote(note);+ setDialogOpen(true);+ };++ const handleDeleteClick = (noteId: string) => {+ setNoteIdToDelete(noteId);+ setDeleteAlertOpen(true);+ };++ const handleDelete = async () => {+ const result = await deleteNote(noteIdToDelete);+ if (result.success) {+ toast({+ variant: "success",+ description: "Note deleted successfully",+ });+ loadNotes();+ } else {+ toast({+ variant: "destructive",+ title: "Error!",+ description: result.message,+ });+ }+ };++ const handleAddNote = () => {+ setEditNote(null);+ setDialogOpen(true);+ };++ const handleSaved = () => {+ setEditNote(null);+ loadNotes();+ };++ return (+ <>+ <Collapsible open={isOpen} onOpenChange={setIsOpen} className="md:col-span-2">+ <div className="flex items-center gap-2">+ <CollapsibleTrigger className="flex items-center gap-2 hover:opacity-80">+ <StickyNote className="h-4 w-4" />+ <span className="text-sm font-medium">Notes</span>+ {notes.length > 0 && (+ <Badge variant="secondary" className="text-xs">+ {notes.length}+ </Badge>+ )}+ <ChevronDown+ className={`h-4 w-4 transition-transform ${isOpen ? "rotate-180" : ""}`}+ />+ </CollapsibleTrigger>+ <Button+ variant="outline"+ size="sm"+ type="button"+ className="h-7 gap-1 ml-auto"+ onClick={handleAddNote}+ >+ <PlusCircle className="h-3.5 w-3.5" />+ Add Note+ </Button>+ </div>+ <CollapsibleContent className="mt-3 space-y-3">+ {notes.length === 0 ? (+ <p className="text-sm text-muted-foreground">No notes yet.</p>+ ) : (+ notes.map((note) => (+ <NoteCard+ key={note.id}+ note={note}+ onEdit={handleEdit}+ onDelete={handleDeleteClick}+ />+ ))+ )}+ </CollapsibleContent>+ </Collapsible>++ <NoteDialog+ open={dialogOpen}+ onOpenChange={setDialogOpen}+ jobId={jobId}+ editNote={editNote}+ onSaved={handleSaved}+ />+ <DeleteAlertDialog+ pageTitle="note"+ open={deleteAlertOpen}+ onOpenChange={setDeleteAlertOpen}+ onDelete={handleDelete}+ />+ </>+ );+}diff --git a/src/components/myjobs/NotesSection.tsx b/src/components/myjobs/NotesSection.tsxnew file mode 100644index 0000000..47e5bbc--- /dev/null+++ b/src/components/myjobs/NotesSection.tsx@@ -0,0 +1,136 @@+"use client";+import { useCallback, useEffect, useState } from "react";+import { NoteResponse } from "@/models/note.model";+import { getNotesByJobId, deleteNote } from "@/actions/note.actions";+import { NoteCard } from "./NoteCard";+import { NoteDialog } from "./NoteDialog";+import { DeleteAlertDialog } from "../DeleteAlertDialog";+import { Button } from "../ui/button";+import { Badge } from "../ui/badge";+import { ChevronDown, PlusCircle, StickyNote } from "lucide-react";+import {+ Collapsible,+ CollapsibleContent,+ CollapsibleTrigger,+} from "../ui/collapsible";+import { toast } from "../ui/use-toast";++type NotesSectionProps = {+ jobId: string;+};++export function NotesSection({ jobId }: NotesSectionProps) {+ const [notes, setNotes] = useState<NoteResponse[]>([]);+ const [isOpen, setIsOpen] = useState(false);+ const [dialogOpen, setDialogOpen] = useState(false);+ const [editNote, setEditNote] = useState<NoteResponse | null>(null);+ const [deleteAlertOpen, setDeleteAlertOpen] = useState(false);+ const [noteIdToDelete, setNoteIdToDelete] = useState("");++ const loadNotes = useCallback(async () => {+ const result = await getNotesByJobId(jobId);+ if (result.success) {+ setNotes(result.data);+ if (result.data.length > 0) setIsOpen(true);+ }+ }, [jobId]);++ useEffect(() => {+ loadNotes();+ }, [loadNotes]);++ const handleEdit = (note: NoteResponse) => {+ setEditNote(note);+ setDialogOpen(true);+ };++ const handleDeleteClick = (noteId: string) => {+ setNoteIdToDelete(noteId);+ setDeleteAlertOpen(true);+ };++ const handleDelete = async () => {+ const result = await deleteNote(noteIdToDelete);+ if (result.success) {+ toast({+ variant: "success",+ description: "Note deleted successfully",+ });+ loadNotes();+ } else {+ toast({+ variant: "destructive",+ title: "Error!",+ description: result.message,+ });+ }+ };++ const handleAddNote = () => {+ setEditNote(null);+ setDialogOpen(true);+ };++ const handleSaved = () => {+ setEditNote(null);+ loadNotes();+ };++ return (+ <>+ <Collapsible open={isOpen} onOpenChange={setIsOpen} className="mx-4 mb-4">+ <div className="flex items-center justify-between">+ <CollapsibleTrigger className="flex items-center gap-2 hover:opacity-80">+ <StickyNote className="h-4 w-4" />+ <span className="font-medium">Notes</span>+ {notes.length > 0 && (+ <Badge variant="secondary" className="text-xs">+ {notes.length}+ </Badge>+ )}+ <ChevronDown+ className={`h-4 w-4 transition-transform ${isOpen ? "rotate-180" : ""}`}+ />+ </CollapsibleTrigger>+ <Button+ variant="outline"+ size="sm"+ className="h-7 gap-1"+ onClick={handleAddNote}+ >+ <PlusCircle className="h-3.5 w-3.5" />+ Add Note+ </Button>+ </div>+ <CollapsibleContent className="mt-3 space-y-3">+ {notes.length === 0 ? (+ <p className="text-sm text-muted-foreground">No notes yet.</p>+ ) : (+ notes.map((note) => (+ <NoteCard+ key={note.id}+ note={note}+ onEdit={handleEdit}+ onDelete={handleDeleteClick}+ />+ ))+ )}+ </CollapsibleContent>+ </Collapsible>++ <NoteDialog+ open={dialogOpen}+ onOpenChange={setDialogOpen}+ jobId={jobId}+ editNote={editNote}+ onSaved={handleSaved}+ />+ <DeleteAlertDialog+ pageTitle="note"+ open={deleteAlertOpen}+ onOpenChange={setDeleteAlertOpen}+ onDelete={handleDelete}+ />+ </>+ );+}diff --git a/src/components/ui/collapsible.tsx b/src/components/ui/collapsible.tsxnew file mode 100644index 0000000..9fa4894--- /dev/null+++ b/src/components/ui/collapsible.tsx@@ -0,0 +1,11 @@+"use client"++import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"++const Collapsible = CollapsiblePrimitive.Root++const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger++const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent++export { Collapsible, CollapsibleTrigger, CollapsibleContent }diff --git a/src/models/job.model.ts b/src/models/job.model.tsindex 0b0e58b..3e0ee4a 100644--- a/src/models/job.model.ts+++ b/src/models/job.model.ts@@ -37,6 +37,7 @@ export interface JobResponse {Resume?: Resume;matchScore?: number | null;matchData?: string | null;+ _count?: { Notes?: number };}export interface JobTitle {diff --git a/src/models/note.model.ts b/src/models/note.model.tsnew file mode 100644index 0000000..0f1b27c--- /dev/null+++ b/src/models/note.model.ts@@ -0,0 +1,12 @@+export interface Note {+ id: string;+ jobId: string;+ userId: string;+ content: string;+ createdAt: Date;+ updatedAt: Date;+}++export interface NoteResponse extends Note {+ isEdited: boolean;+}diff --git a/src/models/note.schema.ts b/src/models/note.schema.tsnew file mode 100644index 0000000..c65582a--- /dev/null+++ b/src/models/note.schema.ts@@ -0,0 +1,9 @@+import { z } from "zod";++export const NoteFormSchema = z.object({+ id: z.string().optional(),+ jobId: z.string({ error: "Job ID is required." }),+ content: z+ .string({ error: "Content is required." })+ .min(1, { message: "Content cannot be empty." }),+});