Skip to content

infosupport/tech-survey

Repository files navigation

Info Support Tech Survey

Setup for local development

  1. Install Rancher (or Docker if you prefer/you have a license) and make sure it is running.
  2. Spin up a postgres database with the following command. You need to choose your own password and username:
docker run --name tech-survey -e "POSTGRES_USER=dummyusr" -e "POSTGRES_PASSWORD=dummypw" -e "POSTGRES_DB=tech-survey" -d -p 5432:5432 docker.io/postgres
  1. Copy .env.example to .env and update the DATABASE_URL variable with the username and password you chose in the previous step. The default value is: DATABASE_URL="postgresql://dummyusr:dummypw@localhost/tech-survey
  2. Create a secret for NEXTAUTH_SECRET by running the following command. Use WSL for this command if you are on Windows.
openssl rand -base64 32
  1. Ask a co-worker for the Azure credentials or the rights to create an app registration yourself.
    1. AZURE_AD_CLIENT_SECRET: A secret credential created in an app registration.
    2. AZURE_AD_CLIENT_ID: The client ID of the app registration.
    3. AZURE_AD_TENANT_ID: The tenant ID of the Azure AD.
  2. Run the following commands to setup your db locally.
npm run db:generate
npm run db:push
  1. You can seed the database with some initial data by running the following command. For this you need a file called survey.csv in the folder ./import. Ask a co-worker for this file.
npm run db:seed

Note that if you run this command again, your database will be populated with duplicate data. 8. Now you should be ready to go! 🎉 You can check your local database by opening the studio of Prisma. Here you should see that the database populated with questions, roles, etc.

npm run db:studio

Running the application

To run the application, you can use the following command:

npm run dev

Running the tests

Tests are done using Playwright. To run the tests, you can use the following command:

npm run test

Code style

In this project, the code style is enforced by ESLint and Prettier. You can run the following command to check if your code is compliant with the code style:

npm run lint

If you want to automatically fix the code style issues, you can run the following command:

npm run lint:fix

Your IDE can help you with this, check out these links:

Database changes

If you make changes to the database schema, you need to generate a new migration. You can do this by running the following command:

npx prisma migrate dev --name <name-of-your-migration>

For more information, look at the Prisma documentation.

About

An app to create tech surveys

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published