-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Convert csv such that we dan seed the database * Add useEffect listener to check if the user is offline * updated example * merge of Issue that removed dependencies on hard coded slugToId * fix .env.example * chmod +x start-database.sh * Use lf instead of crlf in shell script * Fix .env.example again * Use postgres user in start db script * Fill example env with localhost stuff * Remove duplicate code from mobile and desktop components * Moved all duplicate code from mobile and desktop questionaire to util or parent files * Moved all duplicate code from mobile and desktop questionaire to util or parent files * Remove unused form-submit-button component --------- Co-authored-by: Nico Jansen <[email protected]>
- Loading branch information
1 parent
9111c93
commit d1a2f43
Showing
14 changed files
with
909 additions
and
665 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,21 @@ | ||
# When adding additional environment variables, the schema in "/src/env.js" | ||
# should be updated accordingly. | ||
|
||
# Prisma | ||
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env | ||
DATABASE_URL="dummy" | ||
|
||
POSTGRES_USER="dummy" | ||
POSTGRES_PASSWORD="dummy" | ||
POSTGRES_DB="dummy" | ||
POSTGRES_HOST=dummy"" | ||
|
||
# Next Auth | ||
# You can generate a new secret on the command line with: | ||
# openssl rand -base64 32 | ||
# https://next-auth.js.org/configuration/options#secret | ||
NEXTAUTH_SECRET="dummy" | ||
NEXTAUTH_URL="http://localhost:3000" | ||
|
||
# Next Auth Azure-AD Provider | ||
AZURE_AD_CLIENT_ID="dummy" | ||
AZURE_AD_CLIENT_SECRET="dummy" | ||
AZURE_AD_TENANT_ID="dummy" | ||
|
||
STRESS_TEST="false" | ||
|
||
# When adding additional environment variables, the schema in "/src/env.js" | ||
# should be updated accordingly. | ||
|
||
# Prisma | ||
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env | ||
DATABASE_URL="postgresql://dummyusr:dummypw@localhost/tech-survey" | ||
|
||
# Next Auth | ||
# You can generate a new secret on the command line with: | ||
# openssl rand -base64 32 | ||
# https://next-auth.js.org/configuration/options#secret | ||
NEXTAUTH_SECRET="dummy" | ||
NEXTAUTH_URL="http://localhost:3000" | ||
|
||
# Next Auth Azure-AD Provider | ||
AZURE_AD_CLIENT_ID="dummy" | ||
AZURE_AD_CLIENT_SECRET="dummy" | ||
AZURE_AD_TENANT_ID="dummy" | ||
|
||
STRESS_TEST="false" | ||
|
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,162 @@ | ||
-- CreateTable | ||
CREATE TABLE "Survey" ( | ||
"id" TEXT NOT NULL, | ||
"surveyName" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Survey_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Role" ( | ||
"id" TEXT NOT NULL, | ||
"role" TEXT NOT NULL, | ||
"default" BOOLEAN NOT NULL DEFAULT false, | ||
|
||
CONSTRAINT "Role_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Question" ( | ||
"id" TEXT NOT NULL, | ||
"surveyId" TEXT NOT NULL, | ||
"questionText" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Question_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "AnswerOption" ( | ||
"id" TEXT NOT NULL, | ||
"option" INTEGER NOT NULL, | ||
|
||
CONSTRAINT "AnswerOption_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "QuestionResult" ( | ||
"id" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"questionId" TEXT NOT NULL, | ||
"answerId" TEXT NOT NULL, | ||
|
||
CONSTRAINT "QuestionResult_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL, | ||
"name" TEXT, | ||
"email" TEXT, | ||
"emailVerified" TIMESTAMP(3), | ||
"image" TEXT, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Account" ( | ||
"id" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"type" TEXT NOT NULL, | ||
"provider" TEXT NOT NULL, | ||
"providerAccountId" TEXT NOT NULL, | ||
"refresh_token" TEXT, | ||
"access_token" TEXT, | ||
"expires_at" INTEGER, | ||
"ext_expires_in" INTEGER, | ||
"token_type" TEXT, | ||
"scope" TEXT, | ||
"id_token" TEXT, | ||
"session_state" TEXT, | ||
|
||
CONSTRAINT "Account_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Session" ( | ||
"id" TEXT NOT NULL, | ||
"sessionToken" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"expires" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Session_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "VerificationToken" ( | ||
"identifier" TEXT NOT NULL, | ||
"token" TEXT NOT NULL, | ||
"expires" TIMESTAMP(3) NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "_UserRole" ( | ||
"A" TEXT NOT NULL, | ||
"B" TEXT NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "_QuestionToRole" ( | ||
"A" TEXT NOT NULL, | ||
"B" TEXT NOT NULL | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Survey_surveyName_key" ON "Survey"("surveyName"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "_UserRole_AB_unique" ON "_UserRole"("A", "B"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "_UserRole_B_index" ON "_UserRole"("B"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "_QuestionToRole_AB_unique" ON "_QuestionToRole"("A", "B"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "_QuestionToRole_B_index" ON "_QuestionToRole"("B"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Question" ADD CONSTRAINT "Question_surveyId_fkey" FOREIGN KEY ("surveyId") REFERENCES "Survey"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "QuestionResult" ADD CONSTRAINT "QuestionResult_answerId_fkey" FOREIGN KEY ("answerId") REFERENCES "AnswerOption"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "QuestionResult" ADD CONSTRAINT "QuestionResult_questionId_fkey" FOREIGN KEY ("questionId") REFERENCES "Question"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "QuestionResult" ADD CONSTRAINT "QuestionResult_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_UserRole" ADD CONSTRAINT "_UserRole_A_fkey" FOREIGN KEY ("A") REFERENCES "Role"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_UserRole" ADD CONSTRAINT "_UserRole_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_QuestionToRole" ADD CONSTRAINT "_QuestionToRole_A_fkey" FOREIGN KEY ("A") REFERENCES "Question"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_QuestionToRole" ADD CONSTRAINT "_QuestionToRole_B_fkey" FOREIGN KEY ("B") REFERENCES "Role"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
Oops, something went wrong.