ay2324s1-course-assessment-g47 created by GitHub Classroom
- Assignment 1
- Assignment 2
- Assignment 3
- Assignment 4
- Assignment 5 and Project
- Setting up PostgreSQL Permissions
Setup: Run start index.html
in IDE terminal
Note: Since the question data is stored using local storage, no questions will be shown on initial start up, you will need to add some questions manually first.
Follow these steps to run the project:
-
Ensure you have a
.env
file in thebackend
folder.Sample
.env
file content in thebackend
folder:DB_USER=postgres DB_HOST=localhost DB_PASSWORD=YOUR_POSTGRES_PASSWORD DB_PORT=YOUR_POSTGRES_PORT->5432 DB_DATABASE=cs3219_g47 POSTGRESQLPORT=4001 PORT=4000 MONGO_URI=mongodb+srv://default:[email protected]/?retryWrites=true&w=majority
-
Run the following commands in the main directory:
npm run install-all npm run create-db npm run dev
Setup: Follow these steps to run the project:
-
Ensure you have a
.env
file in thebackend
folder.Sample
.env
file content in thebackend
folder:DB_USER=postgres DB_HOST=localhost DB_PASSWORD=YOUR_POSTGRES_PASSWORD DB_PORT=YOUR_POSTGRES_PORT->5432 DB_DATABASE=cs3219_g47 POSTGRESQLPORT=4001 PORT=4000 MONGO_URI=mongodb+srv://default:[email protected]/?retryWrites=true&w=majority ACCESS_TOKEN_SECRET=YOUR_ACCESS_TOKEN_SECRET REFRESH_TOKEN_SECRET=YOUR_REFRESH_TOKEN_SECRET AUTH_EMAIL=[email protected] AUTH_PASS=cs3219grp47
Note: YOUR_ACCESS_TOKEN_SECRET
and YOUR_REFRESH_TOKEN_SECRET
can be a random string
-
Run the following commands in the main directory:
npm run install-all npm run create-db npm run dev
-
The following are the roles and their access:
Role | View Question | Add Question | Delete Question | Edit Role (User and SuperUser) | Edit Role (Admin) |
---|---|---|---|---|---|
Unauthenticated user | No | No | No | No | No |
User | Yes | No | No | No | No |
SuperUser | Yes | Yes | Yes | No | No |
Admin | Yes | Yes | Yes | Yes | No |
SuperAdmin | Yes | Yes | Yes | Yes | Yes |
Login Information for testing:
- User: [email protected], PW: 123456
- SuperUser: [email protected], PW: 123456
- Admin: [email protected], PW: 123456
- SuperAdmin: [email protected], PW: 123456
Setup: Follow these steps to run the project:
- Ensure you have installed Docker Desktop
- Run the following commands in the main directory:
docker-compose down docker-compose up --build
- Wait for the docker to fully initialise and connect to all databases before testing
- Login Information for testing:
- User: [email protected], PW: 123456
- SuperUser: [email protected], PW: 123456
- Admin: [email protected], PW: 123456
- SuperAdmin: [email protected], PW: 123456
Setup: Follow these steps to run the project:
- Ensure you have installed Docker Desktop
- Run the following commands in the main directory:
docker-compose down docker-compose up --build
- Wait for the docker to fully initialise and connect to all databases before testing
- Ensure that you use
localhost
instead oflocalhost:3000
- Login Information for testing:
- User: [email protected], PW: 123456
- SuperUser: [email protected], PW: 123456
- Admin: [email protected], PW: 123456
- SuperAdmin: [email protected], PW: 123456
If you are not using the default PostgreSQL user (postgres
) for your database operations, follow these steps to grant necessary permissions:
-
Open your terminal and enter the PostgreSQL command-line interface:
psql -U postgres
-
Once you're in the PostgreSQL CLI, run the following command to grant superuser privileges to your user:
ALTER USER your_username WITH SUPERUSER;
Replace
your_username
with the actual username you're using for your PostgreSQL database.
These steps ensure that your user has the required permissions to perform CRUD (Create, Read, Update, Delete) operations in PostgreSQL.
Make sure to execute these commands with caution, especially when granting superuser privileges.