mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-29 13:13:54 +08:00
[resumes][feat] add resumes schema (#308)
* [resumes][feat] add resumes schema * [resumes][feat] rename to ResumesSection * [resumes][feat] update resume schema
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -15,5 +15,8 @@
|
|||||||
"typescript.format.enable": true,
|
"typescript.format.enable": true,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll": true
|
"source.fixAll": true
|
||||||
|
},
|
||||||
|
"[prisma]": {
|
||||||
|
"editor.defaultFormatter": "Prisma.prisma"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "ResumesSection" AS ENUM ('GENERAL', 'EDUCATION', 'EXPERIENCE', 'PROJECTS', 'SKILLS');
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "ResumesResume" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"userId" TEXT NOT NULL,
|
||||||
|
"title" TEXT NOT NULL,
|
||||||
|
"additionalInfo" TEXT NOT NULL,
|
||||||
|
"url" TEXT NOT NULL,
|
||||||
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "ResumesResume_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "ResumesStar" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"resumeId" TEXT NOT NULL,
|
||||||
|
"userId" TEXT NOT NULL,
|
||||||
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT "ResumesStar_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "ResumesComment" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"resumeId" TEXT NOT NULL,
|
||||||
|
"userId" TEXT NOT NULL,
|
||||||
|
"description" TEXT NOT NULL,
|
||||||
|
"section" "ResumesSection" NOT NULL,
|
||||||
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "ResumesComment_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "ResumesCommentVote" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"commentId" TEXT NOT NULL,
|
||||||
|
"userId" TEXT NOT NULL,
|
||||||
|
"value" INTEGER NOT NULL,
|
||||||
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "ResumesCommentVote_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "ResumesResume" ADD CONSTRAINT "ResumesResume_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "ResumesStar" ADD CONSTRAINT "ResumesStar_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "ResumesStar" ADD CONSTRAINT "ResumesStar_resumeId_fkey" FOREIGN KEY ("resumeId") REFERENCES "ResumesResume"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "ResumesComment" ADD CONSTRAINT "ResumesComment_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "ResumesComment" ADD CONSTRAINT "ResumesComment_resumeId_fkey" FOREIGN KEY ("resumeId") REFERENCES "ResumesResume"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "ResumesCommentVote" ADD CONSTRAINT "ResumesCommentVote_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "ResumesCommentVote" ADD CONSTRAINT "ResumesCommentVote_commentId_fkey" FOREIGN KEY ("commentId") REFERENCES "ResumesComment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
@ -37,14 +37,18 @@ model Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
name String?
|
name String?
|
||||||
email String? @unique
|
email String? @unique
|
||||||
emailVerified DateTime?
|
emailVerified DateTime?
|
||||||
image String?
|
image String?
|
||||||
accounts Account[]
|
accounts Account[]
|
||||||
sessions Session[]
|
sessions Session[]
|
||||||
todos Todo[]
|
todos Todo[]
|
||||||
|
resumesResumes ResumesResume[]
|
||||||
|
resumesStars ResumesStar[]
|
||||||
|
resumesComments ResumesComment[]
|
||||||
|
resumesCommentVotes ResumesCommentVote[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model VerificationToken {
|
model VerificationToken {
|
||||||
@ -86,6 +90,61 @@ model Company {
|
|||||||
// across all models in this file.
|
// across all models in this file.
|
||||||
// End of Resumes project models.
|
// End of Resumes project models.
|
||||||
|
|
||||||
|
model ResumesResume {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
userId String
|
||||||
|
title String @db.Text
|
||||||
|
additionalInfo String @db.Text
|
||||||
|
// TODO: Add role, experience, location from Enums
|
||||||
|
url String
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
stars ResumesStar[]
|
||||||
|
comments ResumesComment[]
|
||||||
|
}
|
||||||
|
|
||||||
|
model ResumesStar {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
resumeId String
|
||||||
|
userId String
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
resume ResumesResume @relation(fields: [resumeId], references: [id], onDelete: Cascade)
|
||||||
|
}
|
||||||
|
|
||||||
|
model ResumesComment {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
resumeId String
|
||||||
|
userId String
|
||||||
|
description String @db.Text
|
||||||
|
section ResumesSection
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
resume ResumesResume @relation(fields: [resumeId], references: [id], onDelete: Cascade)
|
||||||
|
votes ResumesCommentVote[]
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ResumesSection {
|
||||||
|
GENERAL
|
||||||
|
EDUCATION
|
||||||
|
EXPERIENCE
|
||||||
|
PROJECTS
|
||||||
|
SKILLS
|
||||||
|
}
|
||||||
|
|
||||||
|
model ResumesCommentVote {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
commentId String
|
||||||
|
userId String
|
||||||
|
value Int
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
comment ResumesComment @relation(fields: [commentId], references: [id], onDelete: Cascade)
|
||||||
|
}
|
||||||
|
|
||||||
// Start of Offers project models.
|
// Start of Offers project models.
|
||||||
// Add Offers project models here, prefix all models with "Offer",
|
// Add Offers project models here, prefix all models with "Offer",
|
||||||
// use camelCase for field names, and try to name them consistently
|
// use camelCase for field names, and try to name them consistently
|
||||||
|
Reference in New Issue
Block a user