diff --git a/packages/database/.gitignore b/packages/database/.gitignore index bd30254ac..9fff40f2f 100644 --- a/packages/database/.gitignore +++ b/packages/database/.gitignore @@ -2,3 +2,5 @@ # Temporary for Migration data + +dist diff --git a/packages/database/drizzle.config.ts b/packages/database/drizzle.config.ts index b31d74f3c..ca3c7c21d 100644 --- a/packages/database/drizzle.config.ts +++ b/packages/database/drizzle.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from 'drizzle-kit' export default defineConfig({ - schema: './src/schema.ts', + schema: './dist/schema/index.js', out: './drizzle', dialect: 'postgresql', dbCredentials: { diff --git a/packages/database/drizzle/0000_closed_jack_flag.sql b/packages/database/drizzle/0000_shocking_the_santerians.sql similarity index 99% rename from packages/database/drizzle/0000_closed_jack_flag.sql rename to packages/database/drizzle/0000_shocking_the_santerians.sql index 257d67d79..79c240eb0 100644 --- a/packages/database/drizzle/0000_closed_jack_flag.sql +++ b/packages/database/drizzle/0000_shocking_the_santerians.sql @@ -11,19 +11,19 @@ EXCEPTION END $$; --> statement-breakpoint DO $$ BEGIN - CREATE TYPE "public"."review_status" AS ENUM('PENDING', 'APPROVED', 'REJECTED'); + CREATE TYPE "public"."semester" AS ENUM('1', '2', '3'); EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - CREATE TYPE "public"."semester" AS ENUM('1', '2', '3'); + CREATE TYPE "public"."study_program" AS ENUM('S', 'T', 'I'); EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - CREATE TYPE "public"."study_program" AS ENUM('S', 'T', 'I'); + CREATE TYPE "public"."review_status" AS ENUM('PENDING', 'APPROVED', 'REJECTED'); EXCEPTION WHEN duplicate_object THEN null; END $$; @@ -34,29 +34,6 @@ EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "cart" ( - "id" text PRIMARY KEY NOT NULL, - "user_id" text NOT NULL, - "study_program" "study_program" NOT NULL, - "academic_year" integer NOT NULL, - "semester" "semester" NOT NULL, - "name" text DEFAULT 'Untitled' NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "cart_item" ( - "id" text PRIMARY KEY NOT NULL, - "cart_id" text NOT NULL, - "course_no" text NOT NULL, - "section_no" integer NOT NULL, - "color" text, - "hidden" boolean DEFAULT false NOT NULL, - "cart_order" integer NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint CREATE TABLE IF NOT EXISTS "course" ( "id" text PRIMARY KEY NOT NULL, "study_program" "study_program" NOT NULL, @@ -70,7 +47,7 @@ CREATE TABLE IF NOT EXISTS "course" ( "course_desc_th" text, "faculty" text NOT NULL, "department" text NOT NULL, - "credit" real NOT NULL, + "credit" numeric NOT NULL, "credit_hours" text NOT NULL, "course_condition" text, "midterm_start" timestamp, @@ -84,28 +61,6 @@ CREATE TABLE IF NOT EXISTS "course" ( CONSTRAINT "course_unique" UNIQUE("study_program","academic_year","semester","course_no") ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "review" ( - "id" text PRIMARY KEY NOT NULL, - "user_id" text NOT NULL, - "study_program" "study_program" NOT NULL, - "academic_year" integer NOT NULL, - "semester" "semester" NOT NULL, - "course_no" text NOT NULL, - "content" text NOT NULL, - "rating" integer NOT NULL, - "status" "review_status" DEFAULT 'PENDING' NOT NULL, - "rejection_reason" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "review_votes" ( - "id" text PRIMARY KEY NOT NULL, - "review_id" text NOT NULL, - "user_id" text NOT NULL, - "vote_type" "vote_type" NOT NULL -); ---> statement-breakpoint CREATE TABLE IF NOT EXISTS "course_section" ( "id" text PRIMARY KEY NOT NULL, "course_id" text NOT NULL, @@ -134,6 +89,51 @@ CREATE TABLE IF NOT EXISTS "course_class" ( "updated_at" timestamp DEFAULT now() NOT NULL ); --> statement-breakpoint +CREATE TABLE IF NOT EXISTS "cart" ( + "id" text PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "study_program" "study_program" NOT NULL, + "academic_year" integer NOT NULL, + "semester" "semester" NOT NULL, + "name" text DEFAULT 'Untitled' NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "cart_item" ( + "id" text PRIMARY KEY NOT NULL, + "cart_id" text NOT NULL, + "course_no" text NOT NULL, + "section_no" integer NOT NULL, + "color" text, + "hidden" boolean DEFAULT false NOT NULL, + "cart_order" integer NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "review" ( + "id" text PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "study_program" "study_program" NOT NULL, + "academic_year" integer NOT NULL, + "semester" "semester" NOT NULL, + "course_no" text NOT NULL, + "content" text NOT NULL, + "rating" integer NOT NULL, + "status" "review_status" DEFAULT 'PENDING' NOT NULL, + "rejection_reason" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "review_votes" ( + "id" text PRIMARY KEY NOT NULL, + "review_id" text NOT NULL, + "user_id" text NOT NULL, + "vote_type" "vote_type" NOT NULL +); +--> statement-breakpoint CREATE TABLE IF NOT EXISTS "user" ( "id" text PRIMARY KEY NOT NULL, "email" text NOT NULL, @@ -147,43 +147,43 @@ CREATE TABLE IF NOT EXISTS "user" ( ); --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "cart" ADD CONSTRAINT "cart_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "course_section" ADD CONSTRAINT "course_section_course_id_course_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."course"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "cart_item" ADD CONSTRAINT "cart_item_cart_id_cart_id_fk" FOREIGN KEY ("cart_id") REFERENCES "public"."cart"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "course_class" ADD CONSTRAINT "course_class_section_id_course_section_id_fk" FOREIGN KEY ("section_id") REFERENCES "public"."course_section"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "review" ADD CONSTRAINT "review_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "cart" ADD CONSTRAINT "cart_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "review_votes" ADD CONSTRAINT "review_votes_review_id_review_id_fk" FOREIGN KEY ("review_id") REFERENCES "public"."review"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "cart_item" ADD CONSTRAINT "cart_item_cart_id_cart_id_fk" FOREIGN KEY ("cart_id") REFERENCES "public"."cart"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "review_votes" ADD CONSTRAINT "review_votes_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "review" ADD CONSTRAINT "review_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "course_section" ADD CONSTRAINT "course_section_course_id_course_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."course"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "review_votes" ADD CONSTRAINT "review_votes_review_id_review_id_fk" FOREIGN KEY ("review_id") REFERENCES "public"."review"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "course_class" ADD CONSTRAINT "course_class_section_id_course_section_id_fk" FOREIGN KEY ("section_id") REFERENCES "public"."course_section"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "review_votes" ADD CONSTRAINT "review_votes_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; diff --git a/packages/database/drizzle/meta/0000_snapshot.json b/packages/database/drizzle/meta/0000_snapshot.json index e8d0e86a1..ade8dfb89 100644 --- a/packages/database/drizzle/meta/0000_snapshot.json +++ b/packages/database/drizzle/meta/0000_snapshot.json @@ -1,11 +1,11 @@ { - "id": "3bbbfa61-e1f8-4598-b3a3-313e1fe1b741", + "id": "e865a62d-1e0a-4578-9cfd-b44fbbee2d6f", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", "tables": { - "public.cart": { - "name": "cart", + "public.course": { + "name": "course", "schema": "", "columns": { "id": { @@ -14,12 +14,6 @@ "primaryKey": true, "notNull": true }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, "study_program": { "name": "study_program", "type": "study_program", @@ -40,12 +34,109 @@ "primaryKey": false, "notNull": true }, - "name": { - "name": "name", + "course_no": { + "name": "course_no", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "abbr_name": { + "name": "abbr_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "course_name_en": { + "name": "course_name_en", "type": "text", "primaryKey": false, + "notNull": true + }, + "course_name_th": { + "name": "course_name_th", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "course_desc_en": { + "name": "course_desc_en", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "course_desc_th": { + "name": "course_desc_th", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "faculty": { + "name": "faculty", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "department": { + "name": "department", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credit": { + "name": "credit", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "credit_hours": { + "name": "credit_hours", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "course_condition": { + "name": "course_condition", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "midterm_start": { + "name": "midterm_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "midterm_end": { + "name": "midterm_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "final_start": { + "name": "final_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "final_end": { + "name": "final_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "gen_ed_type": { + "name": "gen_ed_type", + "type": "gen_ed_type", + "typeSchema": "public", + "primaryKey": false, "notNull": true, - "default": "'Untitled'" + "default": "'NO'" + }, + "rating": { + "name": "rating", + "type": "double precision", + "primaryKey": false, + "notNull": false }, "created_at": { "name": "created_at", @@ -63,26 +154,23 @@ } }, "indexes": {}, - "foreignKeys": { - "cart_user_id_user_id_fk": { - "name": "cart_user_id_user_id_fk", - "tableFrom": "cart", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, + "foreignKeys": {}, "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "uniqueConstraints": { + "course_unique": { + "name": "course_unique", + "nullsNotDistinct": false, + "columns": [ + "study_program", + "academic_year", + "semester", + "course_no" + ] + } + } }, - "public.cart_item": { - "name": "cart_item", + "public.course_section": { + "name": "course_section", "schema": "", "columns": { "id": { @@ -91,14 +179,8 @@ "primaryKey": true, "notNull": true }, - "cart_id": { - "name": "cart_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "course_no": { - "name": "course_no", + "course_id": { + "name": "course_id", "type": "text", "primaryKey": false, "notNull": true @@ -109,25 +191,38 @@ "primaryKey": false, "notNull": true }, - "color": { - "name": "color", - "type": "text", + "closed": { + "name": "closed", + "type": "boolean", "primaryKey": false, - "notNull": false + "notNull": true }, - "hidden": { - "name": "hidden", - "type": "boolean", + "regis": { + "name": "regis", + "type": "integer", "primaryKey": false, - "notNull": true, - "default": false + "notNull": true }, - "cart_order": { - "name": "cart_order", + "max": { + "name": "max", "type": "integer", "primaryKey": false, "notNull": true }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gen_ed_type": { + "name": "gen_ed_type", + "type": "gen_ed_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'NO'" + }, "created_at": { "name": "created_at", "type": "timestamp", @@ -145,12 +240,12 @@ }, "indexes": {}, "foreignKeys": { - "cart_item_cart_id_cart_id_fk": { - "name": "cart_item_cart_id_cart_id_fk", - "tableFrom": "cart_item", - "tableTo": "cart", + "course_section_course_id_course_id_fk": { + "name": "course_section_course_id_course_id_fk", + "tableFrom": "course_section", + "tableTo": "course", "columnsFrom": [ - "cart_id" + "course_id" ], "columnsTo": [ "id" @@ -160,10 +255,19 @@ } }, "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "uniqueConstraints": { + "section_unique": { + "name": "section_unique", + "nullsNotDistinct": false, + "columns": [ + "course_id", + "section_no" + ] + } + } }, - "public.course": { - "name": "course", + "public.course_class": { + "name": "course_class", "schema": "", "columns": { "id": { @@ -172,129 +276,212 @@ "primaryKey": true, "notNull": true }, - "study_program": { - "name": "study_program", - "type": "study_program", - "typeSchema": "public", + "section_id": { + "name": "section_id", + "type": "text", "primaryKey": false, "notNull": true }, - "academic_year": { - "name": "academic_year", - "type": "integer", + "type": { + "name": "type", + "type": "text", "primaryKey": false, "notNull": true }, - "semester": { - "name": "semester", - "type": "semester", + "day_of_week": { + "name": "day_of_week", + "type": "day_of_week", "typeSchema": "public", "primaryKey": false, "notNull": true }, - "course_no": { - "name": "course_no", + "period_start": { + "name": "period_start", "type": "text", "primaryKey": false, "notNull": true }, - "abbr_name": { - "name": "abbr_name", + "period_end": { + "name": "period_end", "type": "text", "primaryKey": false, "notNull": true }, - "course_name_en": { - "name": "course_name_en", + "building": { + "name": "building", "type": "text", "primaryKey": false, - "notNull": true + "notNull": false }, - "course_name_th": { - "name": "course_name_th", + "room": { + "name": "room", "type": "text", "primaryKey": false, - "notNull": true + "notNull": false }, - "course_desc_en": { - "name": "course_desc_en", - "type": "text", + "professors": { + "name": "professors", + "type": "text[]", "primaryKey": false, "notNull": false }, - "course_desc_th": { - "name": "course_desc_th", - "type": "text", + "created_at": { + "name": "created_at", + "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": true, + "default": "now()" }, - "faculty": { - "name": "faculty", - "type": "text", + "updated_at": { + "name": "updated_at", + "type": "timestamp", "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "course_class_section_id_course_section_id_fk": { + "name": "course_class_section_id_course_section_id_fk", + "tableFrom": "course_class", + "tableTo": "course_section", + "columnsFrom": [ + "section_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.cart": { + "name": "cart", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, "notNull": true }, - "department": { - "name": "department", + "user_id": { + "name": "user_id", "type": "text", "primaryKey": false, "notNull": true }, - "credit": { - "name": "credit", - "type": "real", + "study_program": { + "name": "study_program", + "type": "study_program", + "typeSchema": "public", "primaryKey": false, "notNull": true }, - "credit_hours": { - "name": "credit_hours", - "type": "text", + "academic_year": { + "name": "academic_year", + "type": "integer", "primaryKey": false, "notNull": true }, - "course_condition": { - "name": "course_condition", + "semester": { + "name": "semester", + "type": "semester", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", "type": "text", "primaryKey": false, - "notNull": false + "notNull": true, + "default": "'Untitled'" }, - "midterm_start": { - "name": "midterm_start", + "created_at": { + "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": true, + "default": "now()" }, - "midterm_end": { - "name": "midterm_end", + "updated_at": { + "name": "updated_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cart_user_id_user_id_fk": { + "name": "cart_user_id_user_id_fk", + "tableFrom": "cart", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.cart_item": { + "name": "cart_item", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true }, - "final_start": { - "name": "final_start", - "type": "timestamp", + "cart_id": { + "name": "cart_id", + "type": "text", "primaryKey": false, - "notNull": false + "notNull": true }, - "final_end": { - "name": "final_end", - "type": "timestamp", + "course_no": { + "name": "course_no", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "section_no": { + "name": "section_no", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "text", "primaryKey": false, "notNull": false }, - "gen_ed_type": { - "name": "gen_ed_type", - "type": "gen_ed_type", - "typeSchema": "public", + "hidden": { + "name": "hidden", + "type": "boolean", "primaryKey": false, "notNull": true, - "default": "'NO'" + "default": false }, - "rating": { - "name": "rating", - "type": "double precision", + "cart_order": { + "name": "cart_order", + "type": "integer", "primaryKey": false, - "notNull": false + "notNull": true }, "created_at": { "name": "created_at", @@ -312,20 +499,23 @@ } }, "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "course_unique": { - "name": "course_unique", - "nullsNotDistinct": false, - "columns": [ - "study_program", - "academic_year", - "semester", - "course_no" - ] + "foreignKeys": { + "cart_item_cart_id_cart_id_fk": { + "name": "cart_item_cart_id_cart_id_fk", + "tableFrom": "cart_item", + "tableTo": "cart", + "columnsFrom": [ + "cart_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" } - } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} }, "public.review": { "name": "review", @@ -491,196 +681,6 @@ "compositePrimaryKeys": {}, "uniqueConstraints": {} }, - "public.course_section": { - "name": "course_section", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "course_id": { - "name": "course_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "section_no": { - "name": "section_no", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "closed": { - "name": "closed", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "regis": { - "name": "regis", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "max": { - "name": "max", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "gen_ed_type": { - "name": "gen_ed_type", - "type": "gen_ed_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'NO'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "course_section_course_id_course_id_fk": { - "name": "course_section_course_id_course_id_fk", - "tableFrom": "course_section", - "tableTo": "course", - "columnsFrom": [ - "course_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "section_unique": { - "name": "section_unique", - "nullsNotDistinct": false, - "columns": [ - "course_id", - "section_no" - ] - } - } - }, - "public.course_class": { - "name": "course_class", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "section_id": { - "name": "section_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "day_of_week": { - "name": "day_of_week", - "type": "day_of_week", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "period_start": { - "name": "period_start", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "period_end": { - "name": "period_end", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "building": { - "name": "building", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "room": { - "name": "room", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "professors": { - "name": "professors", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "course_class_section_id_course_section_id_fk": { - "name": "course_class_section_id_course_section_id_fk", - "tableFrom": "course_class", - "tableTo": "course_section", - "columnsFrom": [ - "section_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, "public.user": { "name": "user", "schema": "", @@ -778,15 +778,6 @@ "IN" ] }, - "public.review_status": { - "name": "review_status", - "schema": "public", - "values": [ - "PENDING", - "APPROVED", - "REJECTED" - ] - }, "public.semester": { "name": "semester", "schema": "public", @@ -805,6 +796,15 @@ "I" ] }, + "public.review_status": { + "name": "review_status", + "schema": "public", + "values": [ + "PENDING", + "APPROVED", + "REJECTED" + ] + }, "public.vote_type": { "name": "vote_type", "schema": "public", @@ -815,6 +815,7 @@ } }, "schemas": {}, + "sequences": {}, "_meta": { "columns": {}, "schemas": {}, diff --git a/packages/database/drizzle/meta/_journal.json b/packages/database/drizzle/meta/_journal.json index abfd40104..55934f9c8 100644 --- a/packages/database/drizzle/meta/_journal.json +++ b/packages/database/drizzle/meta/_journal.json @@ -5,8 +5,8 @@ { "idx": 0, "version": "7", - "when": 1721061287263, - "tag": "0000_closed_jack_flag", + "when": 1727199154437, + "tag": "0000_shocking_the_santerians", "breakpoints": true } ] diff --git a/packages/database/package.json b/packages/database/package.json index 446ef2297..9d7c24ed1 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -5,7 +5,8 @@ "type": "module", "main": "src/index.ts", "scripts": { - "generate": "drizzle-kit generate", + "build-for-drizzle-generate": "tsc", + "generate": "pnpm build-for-drizzle-generate && drizzle-kit generate", "migrate": "dotenv -- tsx src/migrate.ts", "seed": "dotenv -- tsx src/seed/index.ts", "lint": "eslint .", @@ -18,6 +19,7 @@ }, "devDependencies": { "@types/cli-progress": "^3.11.6", + "@types/node": "20", "cli-progress": "^3.12.0", "dotenv-cli": "^7.4.2", "drizzle-kit": "^0.24.2", diff --git a/packages/database/src/index.ts b/packages/database/src/index.ts index 2cccc2dd9..76c93096b 100644 --- a/packages/database/src/index.ts +++ b/packages/database/src/index.ts @@ -1 +1 @@ -export * from './schema.js' +export * from './schema/userData.js' diff --git a/packages/database/src/schema.ts b/packages/database/src/schema.ts deleted file mode 100644 index 6ea7f0fcd..000000000 --- a/packages/database/src/schema.ts +++ /dev/null @@ -1,254 +0,0 @@ -import { createId } from '@paralleldrive/cuid2' -import { - boolean, - doublePrecision, - integer, - pgEnum, - pgTable, - real, - text, - timestamp, - unique, -} from 'drizzle-orm/pg-core' - -// #region CourseData -export const semester = pgEnum('semester', ['1', '2', '3']) -export const studyProgram = pgEnum('study_program', ['S', 'T', 'I']) -export const genEdType = pgEnum('gen_ed_type', ['NO', 'SC', 'SO', 'HU', 'IN']) - -export const course = pgTable( - 'course', - { - id: text('id') - .primaryKey() - .$defaultFn(() => createId()), - - studyProgram: studyProgram('study_program').notNull(), - academicYear: integer('academic_year').notNull(), - semester: semester('semester').notNull(), - - courseNo: text('course_no').notNull(), - abbrName: text('abbr_name').notNull(), - courseNameEn: text('course_name_en').notNull(), - courseNameTh: text('course_name_th').notNull(), - - // Not from Reg Chula - courseDescEn: text('course_desc_en'), - courseDescTh: text('course_desc_th'), - // Not from Reg Chula - - faculty: text('faculty').notNull(), - department: text('department').notNull(), - - credit: real('credit').notNull(), - creditHours: text('credit_hours').notNull(), - - courseCondition: text('course_condition'), - - midtermStart: timestamp('midterm_start'), - midtermEnd: timestamp('midterm_end'), - finalStart: timestamp('final_start'), - finalEnd: timestamp('final_end'), - - // sections: In sections table - - // From GenEd Database - genEdType: genEdType('gen_ed_type').notNull().default('NO'), - - // CU Get Reg's User Data - rating: doublePrecision('rating'), - - createdAt: timestamp('created_at').notNull().defaultNow(), - updatedAt: timestamp('updated_at') - .notNull() - .defaultNow() - .$onUpdate(() => new Date()), - }, - (t) => ({ - courseUnique: unique('course_unique').on( - t.studyProgram, - t.academicYear, - t.semester, - t.courseNo, - ), - }), -) - -export const section = pgTable( - 'course_section', - { - id: text('id') - .primaryKey() - .$defaultFn(() => createId()), - courseId: text('course_id') - .notNull() - .references(() => course.id), - - sectionNo: integer('section_no').notNull(), - closed: boolean('closed').notNull(), - - regis: integer('regis').notNull(), - max: integer('max').notNull(), - - note: text('note'), - genEdType: genEdType('gen_ed_type').notNull().default('NO'), - - createdAt: timestamp('created_at').notNull().defaultNow(), - updatedAt: timestamp('updated_at') - .notNull() - .defaultNow() - .$onUpdate(() => new Date()), - }, - (t) => ({ - sectionUnique: unique('section_unique').on(t.courseId, t.sectionNo), - }), -) - -export const dayOfWeek = pgEnum('day_of_week', [ - 'MO', - 'TU', - 'WE', - 'TH', - 'FR', - 'SA', - 'SU', - 'AR', - 'IA', -]) - -export const sectionClass = pgTable('course_class', { - id: text('id') - .primaryKey() - .$defaultFn(() => createId()), - sectionId: text('section_id') - .notNull() - .references(() => section.id), - - type: text('type').notNull(), - - dayOfWeek: dayOfWeek('day_of_week').notNull(), - periodStart: text('period_start').notNull(), - periodEnd: text('period_end').notNull(), - - building: text('building'), - room: text('room'), - - professors: text('professors').array(), - - createdAt: timestamp('created_at').notNull().defaultNow(), - updatedAt: timestamp('updated_at') - .notNull() - .defaultNow() - .$onUpdate(() => new Date()), -}) -// #endregion CourseData - -// #region UserData -export const user = pgTable('user', { - id: text('id') - .primaryKey() - .$defaultFn(() => createId()), - email: text('email').notNull().unique(), - - name: text('name').notNull(), - image: text('image'), - googleId: text('google_id').notNull().unique(), - - createdAt: timestamp('created_at').notNull().defaultNow(), - updatedAt: timestamp('updated_at') - .notNull() - .defaultNow() - .$onUpdate(() => new Date()), -}) - -export const cart = pgTable('cart', { - id: text('id') - .primaryKey() - .$defaultFn(() => createId()), - userId: text('user_id') - .notNull() - .references(() => user.id), - - studyProgram: studyProgram('study_program').notNull(), - academicYear: integer('academic_year').notNull(), - semester: semester('semester').notNull(), - - name: text('name').notNull().default('Untitled'), - - createdAt: timestamp('created_at').notNull().defaultNow(), - updatedAt: timestamp('updated_at') - .notNull() - .defaultNow() - .$onUpdate(() => new Date()), -}) - -export const cartItem = pgTable('cart_item', { - id: text('id') - .primaryKey() - .$defaultFn(() => createId()), - cartId: text('cart_id') - .notNull() - .references(() => cart.id), - - courseNo: text('course_no').notNull(), - sectionNo: integer('section_no').notNull(), - color: text('color'), - hidden: boolean('hidden').notNull().default(false), - cartOrder: integer('cart_order').notNull(), - - createdAt: timestamp('created_at').notNull().defaultNow(), - updatedAt: timestamp('updated_at') - .notNull() - .defaultNow() - .$onUpdate(() => new Date()), -}) - -export const reviewStatus = pgEnum('review_status', [ - 'PENDING', - 'APPROVED', - 'REJECTED', -]) - -export const review = pgTable('review', { - id: text('id') - .primaryKey() - .$defaultFn(() => createId()), - userId: text('user_id') - .notNull() - .references(() => user.id), - - studyProgram: studyProgram('study_program').notNull(), - academicYear: integer('academic_year').notNull(), - semester: semester('semester').notNull(), - - courseNo: text('course_no').notNull(), - content: text('content').notNull(), - rating: integer('rating').notNull(), - - status: reviewStatus('status').notNull().default('PENDING'), - rejectionReason: text('rejection_reason'), - - createdAt: timestamp('created_at').notNull().defaultNow(), - updatedAt: timestamp('updated_at') - .notNull() - .defaultNow() - .$onUpdate(() => new Date()), -}) - -export const voteType = pgEnum('vote_type', ['L', 'D']) - -export const reviewVotes = pgTable('review_votes', { - id: text('id') - .primaryKey() - .$defaultFn(() => createId()), - - reviewId: text('review_id') - .notNull() - .references(() => review.id), - userId: text('user_id') - .notNull() - .references(() => user.id), - - voteType: voteType('vote_type').notNull(), -}) -// #endregion UserData diff --git a/packages/database/src/schema/courseData.ts b/packages/database/src/schema/courseData.ts new file mode 100644 index 000000000..9dc945926 --- /dev/null +++ b/packages/database/src/schema/courseData.ts @@ -0,0 +1,174 @@ +import { createId } from '@paralleldrive/cuid2' +import { + boolean, + decimal, + doublePrecision, + integer, + pgEnum, + pgTable, + text, + timestamp, + unique, +} from 'drizzle-orm/pg-core' + +import { genEdType, semester, studyProgram } from './types.js' + +/** + * https://datagateway.chula.ac.th (Connect to Chula Wi-Fi) + * DG0206 (ALL CAPS stuff) -> Each row of section class (1NF?) + * DG0403 (snake_case stuff) -> Course Data Only + * DG0216 For Professors Reference + */ +export const course = pgTable( + 'course', + { + id: text('id') + .primaryKey() + .$defaultFn(() => createId()), + + // 19 STUDYPROGRAMSYSTEM + studyProgram: studyProgram('study_program').notNull(), + // 1 YEAR + academicYear: integer('academic_year').notNull(), + // 2 SEMESTER + semester: semester('semester').notNull(), + + // 3 COURSECODE / 11 courseno + courseNo: text('course_no').notNull(), + // 4 COURSENAME + abbrName: text('abbr_name').notNull(), + + // 14 coursename_en + courseNameEn: text('course_name_en').notNull(), + // 13 coursename_th + courseNameTh: text('course_name_th').notNull(), + + // 23 coursedescription_en + courseDescEn: text('course_desc_en'), + // 22 coursedescription_th + courseDescTh: text('course_desc_th'), + + // indirect -> 30 FACCODE or From CourseNo (Transitive Dependency) + faculty: text('faculty').notNull(), + // indirect -> From CourseNo (Transitive Dependency) + department: text('department').notNull(), + + // 24 TOTALCREDIT + credit: decimal('credit').notNull(), + // Must build from 17 lcredit 18 nlcredit 19 lhour 20 nlhour 21 shour + creditHours: text('credit_hours').notNull(), + + // ! not available in data gateway + courseCondition: text('course_condition'), + + // ! not available in data gateway + midtermStart: timestamp('midterm_start'), + midtermEnd: timestamp('midterm_end'), + finalStart: timestamp('final_start'), + finalEnd: timestamp('final_end'), + + // sections for this course: In sections table + + // From section rows OR from gened override? + genEdType: genEdType('gen_ed_type').notNull().default('NO'), + + // CU Get Reg's User Data + rating: doublePrecision('rating'), + + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at') + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), + }, + (t) => ({ + courseUnique: unique('course_unique').on( + t.studyProgram, + t.academicYear, + t.semester, + t.courseNo, + ), + }), +) + +export const section = pgTable( + 'course_section', + { + id: text('id') + .primaryKey() + .$defaultFn(() => createId()), + courseId: text('course_id') + .notNull() + .references(() => course.id), + + // 5 SECTION + sectionNo: integer('section_no').notNull(), + // ! Might not available in Data Gateway + closed: boolean('closed').notNull(), + + // 25 REALREG + regis: integer('regis').notNull(), + // 26 TOTALREG + max: integer('max').notNull(), + + // 27 REMARK1 & 28 REMARK2 & 29 REMARK3 + note: text('note'), + // 20 GENEDSTATUS & 21 GENERALSUBJECT + genEdType: genEdType('gen_ed_type').notNull().default('NO'), + + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at') + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), + }, + (t) => ({ + sectionUnique: unique('section_unique').on(t.courseId, t.sectionNo), + }), +) + +export const dayOfWeek = pgEnum('day_of_week', [ + 'MO', + 'TU', + 'WE', + 'TH', + 'FR', + 'SA', + 'SU', + 'AR', + 'IA', +]) + +export const sectionClass = pgTable('course_class', { + id: text('id') + .primaryKey() + .$defaultFn(() => createId()), + sectionId: text('section_id') + .notNull() + .references(() => section.id), + + // 7 TEACHTYPE + type: text('type').notNull(), + + // 8 DAY1 & 9 DAY2 & ... & 14 DAY7 + // TODO Use array? + dayOfWeek: dayOfWeek('day_of_week').notNull(), + // 15 STARTTIME + periodStart: text('period_start').notNull(), + // 16 ENDTIME + periodEnd: text('period_end').notNull(), + + // 17 BUILDING + building: text('building'), + // 18 ROOM + room: text('room'), + + // DG0216 -> FK(???) 16 NAME_ABBR + professors: text('professors').array(), + + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at') + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), +}) diff --git a/packages/database/src/schema/index.ts b/packages/database/src/schema/index.ts new file mode 100644 index 000000000..6eaa9059b --- /dev/null +++ b/packages/database/src/schema/index.ts @@ -0,0 +1,3 @@ +export * from './courseData.js' +export * from './types.js' +export * from './userData.js' diff --git a/packages/database/src/schema/types.ts b/packages/database/src/schema/types.ts new file mode 100644 index 000000000..9f12390d1 --- /dev/null +++ b/packages/database/src/schema/types.ts @@ -0,0 +1,5 @@ +import { pgEnum } from 'drizzle-orm/pg-core' + +export const semester = pgEnum('semester', ['1', '2', '3']) +export const studyProgram = pgEnum('study_program', ['S', 'T', 'I']) +export const genEdType = pgEnum('gen_ed_type', ['NO', 'SC', 'SO', 'HU', 'IN']) diff --git a/packages/database/src/schema/userData.ts b/packages/database/src/schema/userData.ts new file mode 100644 index 000000000..b573d7505 --- /dev/null +++ b/packages/database/src/schema/userData.ts @@ -0,0 +1,119 @@ +import { createId } from '@paralleldrive/cuid2' +import { + boolean, + integer, + pgEnum, + pgTable, + text, + timestamp, +} from 'drizzle-orm/pg-core' + +import { semester, studyProgram } from './types.js' + +export const user = pgTable('user', { + id: text('id') + .primaryKey() + .$defaultFn(() => createId()), + email: text('email').notNull().unique(), + + name: text('name').notNull(), + image: text('image'), + googleId: text('google_id').notNull().unique(), + + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at') + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), +}) + +export const cart = pgTable('cart', { + id: text('id') + .primaryKey() + .$defaultFn(() => createId()), + userId: text('user_id') + .notNull() + .references(() => user.id), + + studyProgram: studyProgram('study_program').notNull(), + academicYear: integer('academic_year').notNull(), + semester: semester('semester').notNull(), + + name: text('name').notNull().default('Untitled'), + + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at') + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), +}) + +export const cartItem = pgTable('cart_item', { + id: text('id') + .primaryKey() + .$defaultFn(() => createId()), + cartId: text('cart_id') + .notNull() + .references(() => cart.id), + + courseNo: text('course_no').notNull(), + sectionNo: integer('section_no').notNull(), + color: text('color'), + hidden: boolean('hidden').notNull().default(false), + cartOrder: integer('cart_order').notNull(), + + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at') + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), +}) + +export const reviewStatus = pgEnum('review_status', [ + 'PENDING', + 'APPROVED', + 'REJECTED', +]) + +export const review = pgTable('review', { + id: text('id') + .primaryKey() + .$defaultFn(() => createId()), + userId: text('user_id') + .notNull() + .references(() => user.id), + + studyProgram: studyProgram('study_program').notNull(), + academicYear: integer('academic_year').notNull(), + semester: semester('semester').notNull(), + + courseNo: text('course_no').notNull(), + content: text('content').notNull(), + rating: integer('rating').notNull(), + + status: reviewStatus('status').notNull().default('PENDING'), + rejectionReason: text('rejection_reason'), + + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at') + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), +}) + +export const voteType = pgEnum('vote_type', ['L', 'D']) + +export const reviewVotes = pgTable('review_votes', { + id: text('id') + .primaryKey() + .$defaultFn(() => createId()), + + reviewId: text('review_id') + .notNull() + .references(() => review.id), + userId: text('user_id') + .notNull() + .references(() => user.id), + + voteType: voteType('vote_type').notNull(), +}) diff --git a/packages/database/src/seed/steps/_shared.ts b/packages/database/src/seed/steps/_shared.ts index e33693215..ce5d5d74f 100644 --- a/packages/database/src/seed/steps/_shared.ts +++ b/packages/database/src/seed/steps/_shared.ts @@ -1,6 +1,6 @@ import fs from 'node:fs/promises' -import { user } from '../../schema.js' +import { user } from '../../schema/userData.js' import { db } from '../utils/client.js' import { withTimeLog } from '../utils/log.js' import { CourseSeed, ObjectId, ReviewSeed, UserSeed } from '../utils/types.js' diff --git a/packages/database/src/seed/steps/cart.ts b/packages/database/src/seed/steps/cart.ts index 39f1c7342..3df651293 100644 --- a/packages/database/src/seed/steps/cart.ts +++ b/packages/database/src/seed/steps/cart.ts @@ -1,7 +1,7 @@ import cliProgress from 'cli-progress' import { and, eq } from 'drizzle-orm' -import { cart, cartItem } from '../../schema.js' +import { cart, cartItem } from '../../schema/userData.js' import { db } from '../utils/client.js' import { withTimeLog } from '../utils/log.js' import { CourseCart } from '../utils/types.js' diff --git a/packages/database/src/seed/steps/classes.ts b/packages/database/src/seed/steps/classes.ts index 9eba23bf4..45d3fc09a 100644 --- a/packages/database/src/seed/steps/classes.ts +++ b/packages/database/src/seed/steps/classes.ts @@ -1,6 +1,6 @@ import { PgInsertValue } from 'drizzle-orm/pg-core' -import { course, section, sectionClass } from '../../schema.js' +import { course, section, sectionClass } from '../../schema/courseData.js' import { db } from '../utils/client.js' import { withTimeLog } from '../utils/log.js' import { SectionSeed } from '../utils/types.js' diff --git a/packages/database/src/seed/steps/courses.ts b/packages/database/src/seed/steps/courses.ts index c1a7f3b49..841d1f1c4 100644 --- a/packages/database/src/seed/steps/courses.ts +++ b/packages/database/src/seed/steps/courses.ts @@ -1,6 +1,6 @@ import { PgInsertValue } from 'drizzle-orm/pg-core' -import { course } from '../../schema.js' +import { course } from '../../schema/courseData.js' import { db } from '../utils/client.js' import { withTimeLog } from '../utils/log.js' import { parsePeriod } from '../utils/parsing.js' @@ -27,7 +27,7 @@ export const seedCourses = () => courseDescTh: course.courseDescTh, faculty: course.faculty, department: course.department, - credit: course.credit, + credit: String(course.credit), creditHours: course.creditHours, courseCondition: course.courseCondition, midtermStart: midterm.start, diff --git a/packages/database/src/seed/steps/review.ts b/packages/database/src/seed/steps/review.ts index 3acd5b494..d4549d3d8 100644 --- a/packages/database/src/seed/steps/review.ts +++ b/packages/database/src/seed/steps/review.ts @@ -1,6 +1,6 @@ import { PgInsertValue } from 'drizzle-orm/pg-core' -import { review, reviewVotes } from '../../schema.js' +import { review, reviewVotes } from '../../schema/userData.js' import { db } from '../utils/client.js' import { withTimeLog } from '../utils/log.js' import { Interaction, ObjectId } from '../utils/types.js' diff --git a/packages/database/src/seed/steps/sections.ts b/packages/database/src/seed/steps/sections.ts index 44334d47b..1f2f0f9ac 100644 --- a/packages/database/src/seed/steps/sections.ts +++ b/packages/database/src/seed/steps/sections.ts @@ -1,6 +1,6 @@ import { PgInsertValue } from 'drizzle-orm/pg-core' -import { course, section } from '../../schema.js' +import { course, section } from '../../schema/courseData.js' import { db } from '../utils/client.js' import { withTimeLog } from '../utils/log.js' import { SectionSeed } from '../utils/types.js' diff --git a/packages/database/src/seed/steps/users.ts b/packages/database/src/seed/steps/users.ts index 809a807c6..8c22f5fcb 100644 --- a/packages/database/src/seed/steps/users.ts +++ b/packages/database/src/seed/steps/users.ts @@ -1,6 +1,6 @@ import { PgInsertValue } from 'drizzle-orm/pg-core' -import { user } from '../../schema.js' +import { user } from '../../schema/userData.js' import { db } from '../utils/client.js' import { withTimeLog } from '../utils/log.js' import { GoogleSeed } from '../utils/types.js' diff --git a/packages/database/tsconfig.json b/packages/database/tsconfig.json index 7448ac271..6d5f7f86d 100644 --- a/packages/database/tsconfig.json +++ b/packages/database/tsconfig.json @@ -55,7 +55,7 @@ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - // "outDir": "./", /* Specify an output folder for all emitted files. */ + "outDir": "./dist" /* Specify an output folder for all emitted files. */, // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ @@ -105,5 +105,6 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ - } + }, + "include": ["./src/**/*"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ffdfb61dd..d342a9f58 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -256,6 +256,9 @@ importers: '@types/cli-progress': specifier: ^3.11.6 version: 3.11.6 + '@types/node': + specifier: '20' + version: 20.16.6 cli-progress: specifier: ^3.12.0 version: 3.12.0 @@ -1537,6 +1540,9 @@ packages: '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} + '@types/node@20.16.6': + resolution: {integrity: sha512-T7PpxM/6yeDE+AdlVysT62BX6/bECZOmQAgiFg5NoBd5MQheZ3tzal7f1wvzfiEcmrcJNRi2zRr2nY2zF+0uqw==} + '@types/node@22.6.1': resolution: {integrity: sha512-V48tCfcKb/e6cVUigLAaJDAILdMP0fUW6BidkPK4GpGjXcfbnoHasCZDwz3N3yVt5we2RHm4XTQCpv0KJz9zqw==} @@ -5269,6 +5275,10 @@ snapshots: '@types/node@12.20.55': {} + '@types/node@20.16.6': + dependencies: + undici-types: 6.19.8 + '@types/node@22.6.1': dependencies: undici-types: 6.19.8