Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Onboarding for HR and roles #545

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 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
35 changes: 35 additions & 0 deletions prisma/migrations/20241023172043_fix/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
Warnings:

- A unique constraint covering the columns `[companyId]` on the table `User` will be added. If there are existing duplicate values, this will fail.
- Added the required column `companyId` to the `Job` table without a default value. This is not possible if the table is not empty.

*/
-- AlterTable
ALTER TABLE "Job" ADD COLUMN "companyId" TEXT NOT NULL;

-- AlterTable
ALTER TABLE "User" ADD COLUMN "companyId" TEXT;

-- CreateTable
CREATE TABLE "Company" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"website" TEXT,
"description" TEXT,
"userId" TEXT,

CONSTRAINT "Company_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "Company_userId_key" ON "Company"("userId");

-- CreateIndex
CREATE UNIQUE INDEX "User_companyId_key" ON "User"("companyId");

-- AddForeignKey
ALTER TABLE "Company" ADD CONSTRAINT "Company_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Job" ADD CONSTRAINT "Job_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "Company"("id") ON DELETE CASCADE ON UPDATE CASCADE;
12 changes: 12 additions & 0 deletions prisma/migrations/20241023180340_fix_project_mode/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- CreateEnum
CREATE TYPE "ProjectStack" AS ENUM ('GO', 'PYTHON', 'MERN', 'NEXTJS', 'AI_GPT_APIS', 'SPRINGBOOT', 'OTHERS');

-- DropForeignKey
ALTER TABLE "Project" DROP CONSTRAINT "Project_userId_fkey";

-- AlterTable
ALTER TABLE "Project" ADD COLUMN "projectThumbnail" TEXT,
ADD COLUMN "stack" "ProjectStack" NOT NULL DEFAULT 'OTHERS';

-- AddForeignKey
ALTER TABLE "Project" ADD CONSTRAINT "Project_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Company" ADD COLUMN "logo" TEXT;
65 changes: 39 additions & 26 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,40 @@ datasource db {
}

model User {
id String @id @default(cuid())
name String

password String?
avatar String?
isVerified Boolean @default(false)
role Role @default(USER)
jobs Job[]

email String @unique
id String @id @default(cuid())
name String
email String @unique
password String?
avatar String?
isVerified Boolean @default(false)
role Role @default(USER)
emailVerified DateTime?

skills String[]
experience Experience[]
project Project[]
resume String?
jobs Job[]
skills String[]
experience Experience[]
project Project[]
resume String?

oauthProvider OauthProvider? // Tracks OAuth provider (e.g., 'google')
oauthId String?
oauthProvider OauthProvider?
oauthId String?

blockedByAdmin DateTime?
onBoard Boolean @default(false)
bookmark Bookmark[]
onBoard Boolean @default(false)
bookmark Bookmark[]
company Company? @relation("UserCompany")
companyId String? @unique
}

model Company {
id String @id @default(cuid())
name String
logo String?
website String?
description String?
jobs Job[]
user User? @relation("UserCompany", fields: [userId], references: [id])
userId String? @unique
}

enum OauthProvider {
Expand All @@ -55,6 +66,7 @@ enum TokenType {
model Job {
id String @id @default(cuid())
userId String
companyId String
title String
description String?
companyName String @map("company_name")
Expand All @@ -80,23 +92,24 @@ model Job {
maxExperience Int?
isVerifiedJob Boolean @default(false) @map("is_verified_job")
deleted Boolean @default(false)
deletedAt DateTime?
postedAt DateTime @default(now())
updatedAt DateTime @updatedAt

user User @relation(fields: [userId], references: [id], onDelete: Cascade)
company Company @relation(fields: [companyId], references: [id], onDelete: Cascade)
bookmark Bookmark[]
}

model Bookmark {
id String @id @default(uuid())
jobId String
userId String
job Job @relation(fields: [jobId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
id String @id @default(uuid())
jobId String
userId String
job Job @relation(fields: [jobId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model Experience {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
companyName String
designation String
EmploymentType EmployementType
Expand All @@ -107,7 +120,7 @@ model Experience {
endDate DateTime?
description String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id])
}

model Project {
Expand Down
Loading
Loading