From 17564a08d01f0e798ffc20ac10fb91f66708835e Mon Sep 17 00:00:00 2001 From: gpalmer27 Date: Thu, 20 Feb 2025 22:17:48 -0500 Subject: [PATCH 1/2] updated roles and company schema --- .../db/drizzle/0004_massive_moonstone.sql | 12 + packages/db/drizzle/meta/0004_snapshot.json | 721 ++++++++++++++++++ packages/db/drizzle/meta/_journal.json | 7 + packages/db/src/schema/companies.ts | 29 +- packages/db/src/schema/roles.ts | 21 +- 5 files changed, 785 insertions(+), 5 deletions(-) create mode 100644 packages/db/drizzle/0004_massive_moonstone.sql create mode 100644 packages/db/drizzle/meta/0004_snapshot.json diff --git a/packages/db/drizzle/0004_massive_moonstone.sql b/packages/db/drizzle/0004_massive_moonstone.sql new file mode 100644 index 0000000..451776a --- /dev/null +++ b/packages/db/drizzle/0004_massive_moonstone.sql @@ -0,0 +1,12 @@ +ALTER TABLE "company" ADD COLUMN "averageHourlyPay" numeric;--> statement-breakpoint +ALTER TABLE "company" ADD COLUMN "averageOverallRating" numeric;--> statement-breakpoint +ALTER TABLE "company" ADD COLUMN "averageCultureRating" numeric;--> statement-breakpoint +ALTER TABLE "company" ADD COLUMN "averageSupervisorRating" numeric;--> statement-breakpoint +ALTER TABLE "company" ADD COLUMN "averageInterviewRating" numeric;--> statement-breakpoint +ALTER TABLE "company" ADD COLUMN "averageInterviewDifficulty" numeric;--> statement-breakpoint +ALTER TABLE "role" ADD COLUMN "averageHourlyPay" numeric;--> statement-breakpoint +ALTER TABLE "role" ADD COLUMN "averageOverallRating" numeric;--> statement-breakpoint +ALTER TABLE "role" ADD COLUMN "averageCultureRating" numeric;--> statement-breakpoint +ALTER TABLE "role" ADD COLUMN "averageSupervisorRating" numeric;--> statement-breakpoint +ALTER TABLE "role" ADD COLUMN "averageInterviewRating" numeric;--> statement-breakpoint +ALTER TABLE "role" ADD COLUMN "averageInterviewDifficulty" numeric; \ No newline at end of file diff --git a/packages/db/drizzle/meta/0004_snapshot.json b/packages/db/drizzle/meta/0004_snapshot.json new file mode 100644 index 0000000..3f03186 --- /dev/null +++ b/packages/db/drizzle/meta/0004_snapshot.json @@ -0,0 +1,721 @@ +{ + "id": "b20b1281-840d-4c06-9e85-7d149ee467ac", + "prevId": "14a8a6c9-4bc5-4e75-beb7-deee59110a92", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "providerAccountId": { + "name": "providerAccountId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "token_type": { + "name": "token_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "session_state": { + "name": "session_state", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "account_userId_user_id_fk": { + "name": "account_userId_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "account_provider_providerAccountId_pk": { + "name": "account_provider_providerAccountId_pk", + "columns": ["provider", "providerAccountId"] + } + }, + "uniqueConstraints": {} + }, + "public.company": { + "name": "company", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "industry": { + "name": "industry", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "averageHourlyPay": { + "name": "averageHourlyPay", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageOverallRating": { + "name": "averageOverallRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageCultureRating": { + "name": "averageCultureRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageSupervisorRating": { + "name": "averageSupervisorRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageInterviewRating": { + "name": "averageInterviewRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageInterviewDifficulty": { + "name": "averageInterviewDifficulty", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.company_request": { + "name": "company_request", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "industry": { + "name": "industry", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "status": { + "name": "status", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.profile": { + "name": "profile", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "firstName": { + "name": "firstName", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "lastName": { + "name": "lastName", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "major": { + "name": "major", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "minor": { + "name": "minor", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "graduationYear": { + "name": "graduationYear", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "graduationMonth": { + "name": "graduationMonth", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "userId": { + "name": "userId", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "profile_userId_unique": { + "name": "profile_userId_unique", + "nullsNotDistinct": false, + "columns": ["userId"] + } + } + }, + "public.review": { + "name": "review", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workTerm": { + "name": "workTerm", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "workYear": { + "name": "workYear", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "overallRating": { + "name": "overallRating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "cultureRating": { + "name": "cultureRating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "supervisorRating": { + "name": "supervisorRating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "interviewRating": { + "name": "interviewRating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "interviewDifficulty": { + "name": "interviewDifficulty", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "interviewReview": { + "name": "interviewReview", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reviewHeadline": { + "name": "reviewHeadline", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "textReview": { + "name": "textReview", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "hourlyPay": { + "name": "hourlyPay", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "workEnvironment": { + "name": "workEnvironment", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "drugTest": { + "name": "drugTest", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "overtimeNormal": { + "name": "overtimeNormal", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "pto": { + "name": "pto", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "federalHolidays": { + "name": "federalHolidays", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "freeLunch": { + "name": "freeLunch", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "freeTransport": { + "name": "freeTransport", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "freeMerch": { + "name": "freeMerch", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "otherBenefits": { + "name": "otherBenefits", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "roleId": { + "name": "roleId", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "profileId": { + "name": "profileId", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "companyId": { + "name": "companyId", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.role_request": { + "name": "role_request", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "companyId": { + "name": "companyId", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "status": { + "name": "status", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.role": { + "name": "role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "companyId": { + "name": "companyId", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "averageHourlyPay": { + "name": "averageHourlyPay", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageOverallRating": { + "name": "averageOverallRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageCultureRating": { + "name": "averageCultureRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageSupervisorRating": { + "name": "averageSupervisorRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageInterviewRating": { + "name": "averageInterviewRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageInterviewDifficulty": { + "name": "averageInterviewDifficulty", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "sessionToken": { + "name": "sessionToken", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_userId_user_id_fk": { + "name": "session_userId_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "emailVerified": { + "name": "emailVerified", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index c7b367a..1984294 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -29,6 +29,13 @@ "when": 1738615935097, "tag": "0003_yielding_triton", "breakpoints": true + }, + { + "idx": 4, + "version": "7", + "when": 1740106582729, + "tag": "0004_massive_moonstone", + "breakpoints": true } ] } diff --git a/packages/db/src/schema/companies.ts b/packages/db/src/schema/companies.ts index 7d1efea..cd19bc8 100644 --- a/packages/db/src/schema/companies.ts +++ b/packages/db/src/schema/companies.ts @@ -1,5 +1,12 @@ import { relations, sql } from "drizzle-orm"; -import { pgTable, text, timestamp, uuid, varchar } from "drizzle-orm/pg-core"; +import { + decimal, + pgTable, + text, + timestamp, + uuid, + varchar, +} from "drizzle-orm/pg-core"; import { createInsertSchema } from "drizzle-zod"; import { z } from "zod"; @@ -13,6 +20,12 @@ export const Company = pgTable("company", { description: text("description"), industry: varchar("industry").notNull(), location: varchar("location").notNull(), + averageHourlyPay: decimal("averageHourlyPay"), + averageOverallRating: decimal("averageOverallRating"), + averageCultureRating: decimal("averageCultureRating"), + averageSupervisorRating: decimal("averageSupervisorRating"), + averageInterviewRating: decimal("averageInterviewRating"), + averageInterviewDifficulty: decimal("averageInterviewDifficulty"), createdAt: timestamp("createdAt").defaultNow().notNull(), updatedAt: timestamp("updatedAt", { mode: "date", @@ -32,6 +45,14 @@ export const CreateCompanySchema = createInsertSchema(Company, { description: z.string().optional(), industry: z.nativeEnum(Industry), location: z.string(), -}) satisfies z.ZodType< - Omit ->; + averageHourlyPay: z.number(), + averageOverallRating: z.number(), + averageCultureRating: z.number(), + averageSupervisorRating: z.number(), + averageInterviewRating: z.number(), + averageInterviewDifficulty: z.number(), +}).omit({ + id: true, + createdAt: true, + updatedAt: true, +}); diff --git a/packages/db/src/schema/roles.ts b/packages/db/src/schema/roles.ts index 8b3e0aa..f3eb2ce 100644 --- a/packages/db/src/schema/roles.ts +++ b/packages/db/src/schema/roles.ts @@ -1,5 +1,12 @@ import { relations, sql } from "drizzle-orm"; -import { pgTable, text, timestamp, uuid, varchar } from "drizzle-orm/pg-core"; +import { + decimal, + pgTable, + text, + timestamp, + uuid, + varchar, +} from "drizzle-orm/pg-core"; import { createInsertSchema } from "drizzle-zod"; import { z } from "zod"; @@ -12,6 +19,12 @@ export const Role = pgTable("role", { description: text("description"), companyId: varchar("companyId").notNull(), createdAt: timestamp("created_at").defaultNow().notNull(), + averageHourlyPay: decimal("averageHourlyPay"), + averageOverallRating: decimal("averageOverallRating"), + averageCultureRating: decimal("averageCultureRating"), + averageSupervisorRating: decimal("averageSupervisorRating"), + averageInterviewRating: decimal("averageInterviewRating"), + averageInterviewDifficulty: decimal("averageInterviewDifficulty"), updatedAt: timestamp("updatedAt", { mode: "date", withTimezone: true, @@ -32,6 +45,12 @@ export const CreateRoleSchema = createInsertSchema(Role, { title: z.string(), description: z.string(), companyId: z.string(), + averageHourlyPay: z.number(), + averageOverallRating: z.number(), + averageCultureRating: z.number(), + averageSupervisorRating: z.number(), + averageInterviewRating: z.number(), + averageInterviewDifficulty: z.number(), }).omit({ id: true, createdAt: true, From 1fdb8dbf79b638db11add494a27deff30404b925 Mon Sep 17 00:00:00 2001 From: gpalmer27 Date: Fri, 21 Feb 2025 16:42:51 -0500 Subject: [PATCH 2/2] fixed linting --- packages/db/drizzle/0005_loving_cable.sql | 2 + packages/db/drizzle/meta/0005_snapshot.json | 733 ++++++++++++++++++++ packages/db/drizzle/meta/_journal.json | 7 + packages/db/src/schema/companies.ts | 15 +- packages/db/src/schema/roles.ts | 15 +- 5 files changed, 760 insertions(+), 12 deletions(-) create mode 100644 packages/db/drizzle/0005_loving_cable.sql create mode 100644 packages/db/drizzle/meta/0005_snapshot.json diff --git a/packages/db/drizzle/0005_loving_cable.sql b/packages/db/drizzle/0005_loving_cable.sql new file mode 100644 index 0000000..9d3c326 --- /dev/null +++ b/packages/db/drizzle/0005_loving_cable.sql @@ -0,0 +1,2 @@ +ALTER TABLE "company" ADD COLUMN "totalReviews" integer;--> statement-breakpoint +ALTER TABLE "role" ADD COLUMN "totalReviews" integer; \ No newline at end of file diff --git a/packages/db/drizzle/meta/0005_snapshot.json b/packages/db/drizzle/meta/0005_snapshot.json new file mode 100644 index 0000000..0396a1a --- /dev/null +++ b/packages/db/drizzle/meta/0005_snapshot.json @@ -0,0 +1,733 @@ +{ + "id": "8c23acb3-2c81-4141-a602-68b595688adf", + "prevId": "b20b1281-840d-4c06-9e85-7d149ee467ac", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "providerAccountId": { + "name": "providerAccountId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "token_type": { + "name": "token_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "session_state": { + "name": "session_state", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "account_userId_user_id_fk": { + "name": "account_userId_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "account_provider_providerAccountId_pk": { + "name": "account_provider_providerAccountId_pk", + "columns": ["provider", "providerAccountId"] + } + }, + "uniqueConstraints": {} + }, + "public.company": { + "name": "company", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "industry": { + "name": "industry", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "averageHourlyPay": { + "name": "averageHourlyPay", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageOverallRating": { + "name": "averageOverallRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageCultureRating": { + "name": "averageCultureRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageSupervisorRating": { + "name": "averageSupervisorRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageInterviewRating": { + "name": "averageInterviewRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageInterviewDifficulty": { + "name": "averageInterviewDifficulty", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "totalReviews": { + "name": "totalReviews", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.company_request": { + "name": "company_request", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "industry": { + "name": "industry", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "status": { + "name": "status", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.profile": { + "name": "profile", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "firstName": { + "name": "firstName", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "lastName": { + "name": "lastName", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "major": { + "name": "major", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "minor": { + "name": "minor", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "graduationYear": { + "name": "graduationYear", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "graduationMonth": { + "name": "graduationMonth", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "userId": { + "name": "userId", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "profile_userId_unique": { + "name": "profile_userId_unique", + "nullsNotDistinct": false, + "columns": ["userId"] + } + } + }, + "public.review": { + "name": "review", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workTerm": { + "name": "workTerm", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "workYear": { + "name": "workYear", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "overallRating": { + "name": "overallRating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "cultureRating": { + "name": "cultureRating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "supervisorRating": { + "name": "supervisorRating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "interviewRating": { + "name": "interviewRating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "interviewDifficulty": { + "name": "interviewDifficulty", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "interviewReview": { + "name": "interviewReview", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reviewHeadline": { + "name": "reviewHeadline", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "textReview": { + "name": "textReview", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "hourlyPay": { + "name": "hourlyPay", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "workEnvironment": { + "name": "workEnvironment", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "drugTest": { + "name": "drugTest", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "overtimeNormal": { + "name": "overtimeNormal", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "pto": { + "name": "pto", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "federalHolidays": { + "name": "federalHolidays", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "freeLunch": { + "name": "freeLunch", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "freeTransport": { + "name": "freeTransport", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "freeMerch": { + "name": "freeMerch", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "otherBenefits": { + "name": "otherBenefits", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "roleId": { + "name": "roleId", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "profileId": { + "name": "profileId", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "companyId": { + "name": "companyId", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.role_request": { + "name": "role_request", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "companyId": { + "name": "companyId", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "status": { + "name": "status", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.role": { + "name": "role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "companyId": { + "name": "companyId", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "averageHourlyPay": { + "name": "averageHourlyPay", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageOverallRating": { + "name": "averageOverallRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageCultureRating": { + "name": "averageCultureRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageSupervisorRating": { + "name": "averageSupervisorRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageInterviewRating": { + "name": "averageInterviewRating", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "averageInterviewDifficulty": { + "name": "averageInterviewDifficulty", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "totalReviews": { + "name": "totalReviews", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "sessionToken": { + "name": "sessionToken", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_userId_user_id_fk": { + "name": "session_userId_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "emailVerified": { + "name": "emailVerified", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index 1984294..74cb141 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -36,6 +36,13 @@ "when": 1740106582729, "tag": "0004_massive_moonstone", "breakpoints": true + }, + { + "idx": 5, + "version": "7", + "when": 1740174136288, + "tag": "0005_loving_cable", + "breakpoints": true } ] } diff --git a/packages/db/src/schema/companies.ts b/packages/db/src/schema/companies.ts index cd19bc8..aba1467 100644 --- a/packages/db/src/schema/companies.ts +++ b/packages/db/src/schema/companies.ts @@ -1,6 +1,7 @@ import { relations, sql } from "drizzle-orm"; import { decimal, + integer, pgTable, text, timestamp, @@ -26,6 +27,7 @@ export const Company = pgTable("company", { averageSupervisorRating: decimal("averageSupervisorRating"), averageInterviewRating: decimal("averageInterviewRating"), averageInterviewDifficulty: decimal("averageInterviewDifficulty"), + totalReviews: integer("totalReviews"), createdAt: timestamp("createdAt").defaultNow().notNull(), updatedAt: timestamp("updatedAt", { mode: "date", @@ -45,12 +47,13 @@ export const CreateCompanySchema = createInsertSchema(Company, { description: z.string().optional(), industry: z.nativeEnum(Industry), location: z.string(), - averageHourlyPay: z.number(), - averageOverallRating: z.number(), - averageCultureRating: z.number(), - averageSupervisorRating: z.number(), - averageInterviewRating: z.number(), - averageInterviewDifficulty: z.number(), + averageHourlyPay: z.string(), + averageOverallRating: z.string(), + averageCultureRating: z.string(), + averageSupervisorRating: z.string(), + averageInterviewRating: z.string(), + averageInterviewDifficulty: z.string(), + totalReviews: z.number(), }).omit({ id: true, createdAt: true, diff --git a/packages/db/src/schema/roles.ts b/packages/db/src/schema/roles.ts index f3eb2ce..7693576 100644 --- a/packages/db/src/schema/roles.ts +++ b/packages/db/src/schema/roles.ts @@ -1,6 +1,7 @@ import { relations, sql } from "drizzle-orm"; import { decimal, + integer, pgTable, text, timestamp, @@ -25,6 +26,7 @@ export const Role = pgTable("role", { averageSupervisorRating: decimal("averageSupervisorRating"), averageInterviewRating: decimal("averageInterviewRating"), averageInterviewDifficulty: decimal("averageInterviewDifficulty"), + totalReviews: integer("totalReviews"), updatedAt: timestamp("updatedAt", { mode: "date", withTimezone: true, @@ -45,12 +47,13 @@ export const CreateRoleSchema = createInsertSchema(Role, { title: z.string(), description: z.string(), companyId: z.string(), - averageHourlyPay: z.number(), - averageOverallRating: z.number(), - averageCultureRating: z.number(), - averageSupervisorRating: z.number(), - averageInterviewRating: z.number(), - averageInterviewDifficulty: z.number(), + averageHourlyPay: z.string(), + averageOverallRating: z.string(), + averageCultureRating: z.string(), + averageSupervisorRating: z.string(), + averageInterviewRating: z.string(), + averageInterviewDifficulty: z.string(), + totalReviews: z.number(), }).omit({ id: true, createdAt: true,