-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from stamford-syntax-club/khing/add-term-sec
- Loading branch information
Showing
20 changed files
with
367 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
{ | ||
"name": "reviews-api", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "go run main.go -environment=development.local", | ||
"unit": "go clean -testcache && go test -tags=unit -v ./...", | ||
"unit-coverage": "go clean -testcache && go test -tags=unit -coverprofile=coverage.out ./... && go tool cover -html=coverage.out -o coverage.html && open coverage.html", | ||
"gen-sql": "go run github.com/steebchen/prisma-client-go migrate diff --from-empty --to-schema-datasource='../../packages/prisma/schema.prisma' --script > review/data/datasource/db/generated.sql", | ||
"integration": "docker compose -f docker-compose.integration.yaml down -v && docker compose -f docker-compose.integration.yaml up --build --force-recreate --exit-code-from integration-test", | ||
"bootstrap:unix": "PRISMA_PROVIDER='go run github.com/steebchen/prisma-client-go' PRISMA_OUTPUT='../../apps/reviews-api/review/data/datasource/db' go run github.com/steebchen/prisma-client-go generate --schema=../../packages/prisma/schema.prisma", | ||
"bootstrap:windows": "@powershell $env:PRISMA_PROVIDER='go run github.com/steebchen/prisma-client-go'; $env:PRISMA_OUTPUT='../../apps/reviews-api/review/data/datasource/db'; go run github.com/steebchen/prisma-client-go generate --schema=../../packages/prisma/schema.prisma" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
-- CreateTable | ||
CREATE TABLE "Course" ( | ||
"id" SERIAL NOT NULL, | ||
"code" TEXT NOT NULL, | ||
"full_name" TEXT NOT NULL, | ||
"prerequisites" TEXT[], | ||
|
||
CONSTRAINT "Course_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Profile" ( | ||
"id" UUID NOT NULL, | ||
"username" TEXT, | ||
"isActive" BOOLEAN NOT NULL DEFAULT false, | ||
|
||
CONSTRAINT "Profile_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Review" ( | ||
"id" SERIAL NOT NULL, | ||
"academic_year" INTEGER NOT NULL, | ||
"description" TEXT NOT NULL, | ||
"rating" DOUBLE PRECISION NOT NULL, | ||
"votes" INTEGER NOT NULL, | ||
"status" TEXT NOT NULL, | ||
"rejectedReason" TEXT NOT NULL DEFAULT '', | ||
"course_id" INTEGER NOT NULL, | ||
"user_id" UUID NOT NULL, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3), | ||
"section" INTEGER, | ||
"term" INTEGER, | ||
|
||
CONSTRAINT "Review_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Course_code_key" ON "Course"("code" ASC); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Review" ADD CONSTRAINT "Review_course_id_fkey" FOREIGN KEY ("course_id") REFERENCES "Course"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Review" ADD CONSTRAINT "Review_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "Profile"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
INSERT INTO "Course" (code, full_name, prerequisites) VALUES | ||
('CSCI101', 'Introduction to Computer Science', '{}'), | ||
('MATH201', 'Calculus I', '{}'), | ||
('PHYS101', 'Physics for Engineers', '{"MATH201"}'), | ||
('NOREVIEW101', 'Course without reviews', '{}'), | ||
('ITE221', 'Programming 1', '{"ITE103"}'); | ||
|
||
-- Inserting data into the Profile table | ||
INSERT INTO "Profile" (id, "isActive", username) VALUES | ||
('8a7b3c2e-3e5f-4f1a-a8b7-3c2e1a4f5b6d', true, NULL), | ||
('2d1f3c4e-5a6b-7c8d-9e0f-1a2b3c4d5e6f', true, NULL), | ||
('1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d', false, NULL), | ||
('d5a59cb2-1f22-4e23-8ef0-7108e54f842b', true, NULL), | ||
('6c7b1dd2-aa9d-4f5e-8a98-2c7c2895a95e', true, NULL), | ||
('8b84c3b5-5b87-4c9b-832d-60d0966d4f7d', true, NULL), | ||
('3f9e87a9-6d27-4a09-8a0a-20e58d609315', true, NULL), | ||
('2b84c3b5-5b87-4c9b-832d-60d0966d4f7d', false, NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.