diff --git a/app/(cv)/editor/(sections)/Education.tsx b/app/(cv)/editor/(sections)/Education.tsx index 104d736..08a877a 100644 --- a/app/(cv)/editor/(sections)/Education.tsx +++ b/app/(cv)/editor/(sections)/Education.tsx @@ -7,6 +7,9 @@ import { useSession } from "next-auth/react"; import { getProfessionalByEmail } from "@/services/sessionService"; import { MdOutlineModeEdit } from "react-icons/md"; import { MdOutlineDeleteOutline } from "react-icons/md"; +import prisma from "@/lib/prisma"; +import { Prisma } from "@prisma/client"; + interface Education { education_id: string; school: string; @@ -74,9 +77,9 @@ const EducationComponent: React.FC = ({ educations, setEducation setEducations((prevEducations) => prevEducations.filter((_, idx) => idx !== index) ); - }catch (error) { + }catch (error:any) { console.error('Error deleting education:', error); - if (error instanceof prisma.PrismaClientKnownRequestError && error.code === 'P2025') { + if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === 'P2025') { // Optionally remove the record from the state if it does not exist in the database setEducations((prevEducations) => prevEducations.filter((education) => education.education_id !== educationID) diff --git a/app/(cv)/editor/(sections)/Projects.tsx b/app/(cv)/editor/(sections)/Projects.tsx index d2613f8..e4a24c9 100644 --- a/app/(cv)/editor/(sections)/Projects.tsx +++ b/app/(cv)/editor/(sections)/Projects.tsx @@ -6,6 +6,7 @@ import { useSession } from "next-auth/react"; import { getProfessionalByEmail } from "@/services/sessionService"; import { MdOutlineModeEdit } from "react-icons/md"; import { MdOutlineDeleteOutline } from "react-icons/md"; +import { Prisma } from "@prisma/client"; interface Project { project_id: string; @@ -73,7 +74,7 @@ const Projects: React.FC = ({projectsList, setProjects, profession ); }catch (error) { console.error('Error deleting project:', error); - if (error instanceof prisma.PrismaClientKnownRequestError && error.code === 'P2025') { + if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === 'P2025') { setProjects((prevProjects) => prevProjects.filter((project) => project.project_id !== projectID) ); diff --git a/app/(cv)/editor/(sections)/Skills.tsx b/app/(cv)/editor/(sections)/Skills.tsx index 8c55fe2..5d8e8d4 100644 --- a/app/(cv)/editor/(sections)/Skills.tsx +++ b/app/(cv)/editor/(sections)/Skills.tsx @@ -5,6 +5,7 @@ import { update } from "cypress/types/lodash"; import { useSession } from "next-auth/react"; import { getProfessionalByEmail } from "@/services/sessionService"; import { MdOutlineModeEdit, MdOutlineDeleteOutline } from "react-icons/md"; +import { Prisma } from "@prisma/client"; interface Skill { skill_id: string; @@ -68,7 +69,7 @@ const Skills: React.FC = ({ skillList, setSkills, professionalID }) ); } catch (error) { console.error('Error deleting skill:', error); - if (error instanceof prisma.PrismaClientKnownRequestError && error.code === 'P2025') { + if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === 'P2025') { setSkills((prevSkills) => prevSkills.filter((skill) => skill.skill_id !== skillID) ); diff --git a/app/(cv)/editor/(sections)/WorkExperience.tsx b/app/(cv)/editor/(sections)/WorkExperience.tsx index 9bcd04d..d0afa7c 100644 --- a/app/(cv)/editor/(sections)/WorkExperience.tsx +++ b/app/(cv)/editor/(sections)/WorkExperience.tsx @@ -7,6 +7,7 @@ import { useSession } from "next-auth/react"; import { getProfessionalByEmail } from "@/services/sessionService"; import { MdOutlineModeEdit } from "react-icons/md"; import { MdOutlineDeleteOutline } from "react-icons/md"; +import { Prisma } from "@prisma/client"; interface Work { work_experience_id : string; @@ -75,7 +76,7 @@ const WorkExperience: React.FC = ({works, setWorks, professionalID}) ); }catch (error) { console.error('Error deleting work:', error); - if (error instanceof prisma.PrismaClientKnownRequestError && error.code === 'P2025') { + if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === 'P2025') { setWorks((prevWorks) => prevWorks.filter((work) => work.work_experience_id !== workID) );