Skip to content

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.

Add profile and resume schema

Khuram Niaz3a1490b49892
diff --git a/prisma/migrations/20240624230528_add_profile_resume_models/migration.sql b/prisma/migrations/20240624230528_add_profile_resume_models/migration.sql
new file mode 100644
index 0000000..f06ecb7
--- /dev/null
+++ b/prisma/migrations/20240624230528_add_profile_resume_models/migration.sql
@@ -0,0 +1,112 @@
+-- CreateTable
+CREATE TABLE "Profile" (
+ "id" TEXT NOT NULL PRIMARY KEY,
+ "userId" TEXT NOT NULL,
+ CONSTRAINT "Profile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
+);
+
+-- CreateTable
+CREATE TABLE "Resume" (
+ "id" TEXT NOT NULL PRIMARY KEY,
+ "profileId" TEXT NOT NULL,
+ "title" TEXT NOT NULL,
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" DATETIME NOT NULL,
+ "summaryId" TEXT,
+ CONSTRAINT "Resume_profileId_fkey" FOREIGN KEY ("profileId") REFERENCES "Profile" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
+);
+
+-- CreateTable
+CREATE TABLE "ResumeSection" (
+ "id" TEXT NOT NULL PRIMARY KEY,
+ "resumeId" TEXT NOT NULL,
+ "sectionTitle" TEXT NOT NULL,
+ "sectionType" TEXT NOT NULL,
+ "summaryId" TEXT,
+ CONSTRAINT "ResumeSection_summaryId_fkey" FOREIGN KEY ("summaryId") REFERENCES "Summary" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT "ResumeSection_resumeId_fkey" FOREIGN KEY ("resumeId") REFERENCES "Resume" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
+);
+
+-- CreateTable
+CREATE TABLE "ContactInfo" (
+ "id" TEXT NOT NULL PRIMARY KEY,
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" DATETIME NOT NULL,
+ "resumeId" TEXT NOT NULL,
+ "firstName" TEXT NOT NULL,
+ "lastName" TEXT NOT NULL,
+ "headline" TEXT NOT NULL,
+ "email" TEXT NOT NULL,
+ "phone" TEXT NOT NULL,
+ "address" TEXT,
+ CONSTRAINT "ContactInfo_resumeId_fkey" FOREIGN KEY ("resumeId") REFERENCES "Resume" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
+);
+
+-- CreateTable
+CREATE TABLE "Summary" (
+ "id" TEXT NOT NULL PRIMARY KEY,
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" DATETIME NOT NULL,
+ "content" TEXT NOT NULL
+);
+
+-- CreateTable
+CREATE TABLE "WorkExperience" (
+ "id" TEXT NOT NULL PRIMARY KEY,
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" DATETIME NOT NULL,
+ "companyId" TEXT NOT NULL,
+ "jobTitleId" TEXT NOT NULL,
+ "startDate" DATETIME NOT NULL,
+ "endDate" DATETIME,
+ "description" TEXT NOT NULL,
+ "locationId" TEXT NOT NULL,
+ "resumeSectionId" TEXT,
+ CONSTRAINT "WorkExperience_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "Company" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
+ CONSTRAINT "WorkExperience_jobTitleId_fkey" FOREIGN KEY ("jobTitleId") REFERENCES "JobTitle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
+ CONSTRAINT "WorkExperience_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "Location" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
+ CONSTRAINT "WorkExperience_resumeSectionId_fkey" FOREIGN KEY ("resumeSectionId") REFERENCES "ResumeSection" ("id") ON DELETE SET NULL ON UPDATE CASCADE
+);
+
+-- CreateTable
+CREATE TABLE "Education" (
+ "id" TEXT NOT NULL PRIMARY KEY,
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" DATETIME NOT NULL,
+ "institution" TEXT NOT NULL,
+ "degree" TEXT NOT NULL,
+ "fieldOfStudy" TEXT NOT NULL,
+ "startDate" DATETIME NOT NULL,
+ "endDate" DATETIME,
+ "description" TEXT,
+ "locationId" TEXT NOT NULL,
+ "resumeSectionId" TEXT,
+ CONSTRAINT "Education_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "Location" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
+ CONSTRAINT "Education_resumeSectionId_fkey" FOREIGN KEY ("resumeSectionId") REFERENCES "ResumeSection" ("id") ON DELETE SET NULL ON UPDATE CASCADE
+);
+
+-- CreateTable
+CREATE TABLE "LicenseOrCertification" (
+ "id" TEXT NOT NULL PRIMARY KEY,
+ "title" TEXT NOT NULL,
+ "organization" TEXT NOT NULL,
+ "issueDate" DATETIME,
+ "expirationDate" DATETIME,
+ "credentialUrl" TEXT,
+ "resumeSectionId" TEXT,
+ CONSTRAINT "LicenseOrCertification_resumeSectionId_fkey" FOREIGN KEY ("resumeSectionId") REFERENCES "ResumeSection" ("id") ON DELETE SET NULL ON UPDATE CASCADE
+);
+
+-- CreateTable
+CREATE TABLE "OtherSection" (
+ "id" TEXT NOT NULL PRIMARY KEY,
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" DATETIME NOT NULL,
+ "title" TEXT NOT NULL,
+ "content" TEXT NOT NULL,
+ "resumeSectionId" TEXT,
+ CONSTRAINT "OtherSection_resumeSectionId_fkey" FOREIGN KEY ("resumeSectionId") REFERENCES "ResumeSection" ("id") ON DELETE SET NULL ON UPDATE CASCADE
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "ContactInfo_resumeId_key" ON "ContactInfo"("resumeId");
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index e13e129..c855f02 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -23,6 +23,116 @@ model User {
Location Location[]
Company Company[]
Contact Contact[]
+ Profile Profile[]
+}
+
+model Profile {
+ id String @id @default(uuid())
+ userId String
+ user User @relation(fields: [userId], references: [id])
+ resumes Resume[]
+}
+
+model Resume {
+ id String @id @default(uuid())
+ profileId String
+ title String
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ ContactInfo ContactInfo?
+ ResumeSections ResumeSection[]
+ profile Profile @relation(fields: [profileId], references: [id])
+ summaryId String?
+}
+
+model ResumeSection {
+ id String @id @default(uuid())
+ resumeId String
+ sectionTitle String
+ sectionType String
+ summaryId String?
+ summary Summary? @relation(fields: [summaryId], references: [id])
+ workExperiences WorkExperience[]
+ educations Education[]
+ licenseOrCertifications LicenseOrCertification[]
+ others OtherSection[]
+ Resume Resume @relation(fields: [resumeId], references: [id])
+}
+
+model ContactInfo {
+ id String @id @default(uuid())
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ resumeId String @unique
+ firstName String
+ lastName String
+ headline String
+ email String
+ phone String
+ address String?
+ resume Resume @relation(fields: [resumeId], references: [id])
+}
+
+model Summary {
+ id String @id @default(uuid())
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ content String
+ ResumeSection ResumeSection[]
+}
+
+model WorkExperience {
+ id String @id @default(uuid())
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ companyId String
+ Company Company @relation(fields: [companyId], references: [id])
+ jobTitleId String
+ jobTitle JobTitle @relation(fields: [jobTitleId], references: [id])
+ startDate DateTime
+ endDate DateTime?
+ description String
+ locationId String
+ location Location @relation(fields: [locationId], references: [id])
+ resumeSectionId String?
+ ResumeSection ResumeSection? @relation(fields: [resumeSectionId], references: [id])
+}
+
+model Education {
+ id String @id @default(uuid())
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ institution String
+ degree String
+ fieldOfStudy String
+ startDate DateTime
+ endDate DateTime?
+ description String?
+ locationId String
+ location Location @relation(fields: [locationId], references: [id])
+ resumeSectionId String?
+ ResumeSection ResumeSection? @relation(fields: [resumeSectionId], references: [id])
+}
+
+model LicenseOrCertification {
+ id String @id @default(uuid())
+ title String
+ organization String
+ issueDate DateTime?
+ expirationDate DateTime?
+ credentialUrl String?
+ ResumeSection ResumeSection? @relation(fields: [resumeSectionId], references: [id])
+ resumeSectionId String?
+}
+
+model OtherSection {
+ id String @id @default(uuid())
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ title String
+ content String
+ ResumeSection ResumeSection? @relation(fields: [resumeSectionId], references: [id])
+ resumeSectionId String?
}
model Contact {
@@ -37,12 +147,13 @@ model Contact {
}
model JobTitle {
- id String @id @default(uuid())
- label String
- value String @unique //TODO: Change and Apply unique constraint on index with value and userid
- jobs Job[]
- createdBy String // userId
- user User @relation(fields: [createdBy], references: [id])
+ id String @id @default(uuid())
+ label String
+ value String @unique //TODO: Change and Apply unique constraint on index with value and userid
+ jobs Job[]
+ createdBy String // userId
+ user User @relation(fields: [createdBy], references: [id])
+ workExperiences WorkExperience[]
}
model JobStatus {
@@ -53,24 +164,27 @@ model JobStatus {
}
model Location {
- id String @id @default(uuid())
- label String
- value String
- stateProv String?
- country String?
- jobsApplied Job[]
- createdBy String // userId
- user User @relation(fields: [createdBy], references: [id])
+ id String @id @default(uuid())
+ label String
+ value String
+ stateProv String?
+ country String?
+ jobsApplied Job[]
+ createdBy String // userId
+ user User @relation(fields: [createdBy], references: [id])
+ educations Education[]
+ workExperience WorkExperience[]
}
model Company {
- id String @id @default(uuid())
- label String
- value String @unique
- jobsApplied Job[]
- logoUrl String? // field is optional
- createdBy String // userId
- user User @relation(fields: [createdBy], references: [id])
+ id String @id @default(uuid())
+ label String
+ value String @unique
+ jobsApplied Job[]
+ logoUrl String? // field is optional
+ createdBy String // userId
+ user User @relation(fields: [createdBy], references: [id])
+ workExperiences WorkExperience[]
}
model JobSource {
diff --git a/src/actions/job.actions.ts b/src/actions/job.actions.ts
index d75bdb0..d1add4e 100644
--- a/src/actions/job.actions.ts
+++ b/src/actions/job.actions.ts
@@ -68,7 +68,7 @@ export const getJobsList = async (
},
orderBy: {
createdAt: "desc",
- appliedDate: "desc",
+ // appliedDate: "desc",
},
}),
prisma.job.count({