dhbw-project-backend • dhbw-project-frontend • dhbw-project-documentation
-
Clone this project and checkout the master branch.
-
Create a folder
env
. -
Create a file
app.properties
inside the env folder with the following properties (example values):app.port = 3000 app.defaultUser = admin app.defaultPassword = defaultpasswordhere app.isAdmin = true app.forceSync = false app.enableTestData = false server.user = dhbw server.database = becker server.password = iH0p3youU5EaSecretPa$$word server.port = 5432 server.dialect = postgres jwt.superSecret = TreevgQreNefpuUngHroreunhcgAvpugfTrznpug13 server.host = postgres pepper = ErarFgvaxg
-
Create a file
.env
inside thedocker
folder with the following properties (example). Be sure, that the postgres password and user are like the server config inapp.properties
:postgres_user=dhbw postgres_password=iH0p3youU5EaSecretPa$$word postgres_port=5432 [email protected] pgadmin_password=test1234
-
Copy the server certifcates into the
/docker/nginx/ssl
directory. Example certificate files can be found here.
-
Do the common steps.
-
Install all node modules:
npm install
-
Change the
server.host
in theapp.properties
file tolocalhost
. -
Open terminal and start docker:
...\dhbw-project-backend> cd .\docker\ ...\dhbw-project-backend\docker> docker-compose -f docker-compose-backend.yaml up --build
-
Open a second terminal and start your app. For deploying we suggest to use
nodemon
:node app.js or nodemon app.js
- After the common setup steps, please start the backend:
...\dhbw-project-backend> cd .\docker\ ...\dhbw-project-backend\docker> docker-compose -f docker-compose-frontend.yaml up --build
- The backend APIs are available at: https://localhost/api/{ressource}
- Clone front- and backend into the same directory
- Be sure, that the common steps are done.
- Start the project.
...\dhbw-project-backend> cd .\docker\ ...\dhbw-project-backend\docker> docker-compose up --build
...\dhbw-project-backend\docker> docker-compose down
OR
...\dhbw-project-backend\docker> docker-compose -f docker-compose-backend.yaml down
OR
...\dhbw-project-backend\docker> docker-compose -f docker-compose-frontend.yaml down
Prettier is a useful tool to format the code in a standard way.
Install Prettier - Code formatter
from Esben Petersen as vs-code-extension.
There's a .prettierrc.json in the root directory of this repository, which defines how the code should be formatted.
You can use prettier by right clicking in the editor inside a code file.
Format Document With
: and choose Prettier - Code formatter
or Alt + Shift + F
(Windows) / Command + Shift + F
(Mac).
- Install postman.
- Use the import function and import the collection and environments found inside the postman folder.
- Select the correct environment for your usage and you are ready* to go.
- "Peojekt-Backend" is for backend developers.
- "Peojekt-Frontend" is for frontend developers.
- [frontend-only] When using postman to verify the routes please disable ssl certificate verification in postman.
- Disable file → settings → ssl certificate verification.****
* Important Note: To use the route addLecturerCV you need to access an PDF File on your computer. There already is an example file ("resume.pdf") within the postman-folder. To access it you either have to set your Postman-Working-Directory (Settings -> General -> Working directory section) to your Postman folder within the Peojekt-Backend structure. (e. g. "/Users/[yourName]/Documents/GitHub/dhbw-project-backend/postman"). It is also possible to select an own pdf-file in your current working directory or select the option to give access outside the working directory.
* Routes that require an ID need to be filled by you.
These parameters have the value [REQUIRED]
and need to be updated by you.
* There are two collections that can be used for testing. The Peoject-Test Collection provides status tests for every route in a logical order. In addition to that you can use the Project-Test-Errors Collection to check on error status-messages for e.g. wrong use of the route or missing permissions. Make sure to run Peojekt-Test before Peoject-Test-Errors to have everything setup properly.
You can use admin
as login name with password test
or its token eyJpe0JEKTAiOjAsImFsZyI6IkhTMjU2IiwidHlwIjoiSldUIn0.eyJ1c2VybmFtZSI6ImFkbWluIiwiZGlyZWN0b3JPZlN0dWRpZXNfaWQiOjEsImlhdCI6MTU5MjE3NjQ4MCwiZXhwIjoxNTk4MTM4MDgwfQ.CFzby-2_Q6h-_LsP_dP7IIzyL5ozu_UdV-dzyJdnQAk
to authenticate yourself.
To see how authentication with the token works take a look at the postman collection.
(It uses this token as variable {{token}}
.)
PDF files are stored in pdf
-folder which will be created automatically if app.forceSync
is set to true.
For better structuring there is a subfolder for each type of PDF files.
Currently we only store CVs of lecturers in pdf/cv
.
The files are named {ID}.pdf
where {ID}
is the lecturer_id
of the corresponding lecturer.
There is a configuration file where the register key and Google API key is saved.
It is automatically updated when one of the corresponding routes is called and created when app.forceSync
is set to true.
The file keys.json
has the following format:
{
"registerKey": "used to create an account",
"googleCalendar": {
"apiKey": "api key",
"[further keys]": "[further values]"
}
}
If you want to know how to use the routes and speak german, take a look at the postman collection or the api docs. If you want to know more about our database design and speak german, take a look at our database documentation
route name | http method | route | parameters | status | docs |
---|---|---|---|---|---|
Login | POST |
/login |
✅ | auth.md | |
[EOL] Signup | - | - | ⛔ | auth.md | |
Register with register key | POST |
/register |
✅ | auth.md | |
Change own password | PUT |
/changePassword |
directorOfStudiesId |
✅ | directorOfStudies.md |
Get all attributes to the current director of studies | GET |
/directorOfStudies |
token |
✅ | directorOfStudies.md |
Update the current director of studies | PUT |
/directorOfStudies |
token |
✅ | directorOfStudies.md |
[Admin routes] Get all users | GET |
/users |
token |
✅ | admin.md |
[Admin routes] Create new director of studies | POST |
/createUser |
token |
✅ | admin.md |
[Admin routes] Reset password of director of studies | PUT |
/resetPassword |
token , directorOfStudiesId |
✅ | admin.md |
[Admin routes] Give director of studies admin privileges | PUT |
/upgradeToAdmin |
token , directorOfStudiesId |
✅ | admin.md |
[Admin routes] Get register key | GET |
/registerKey |
token |
✅ | admin.md |
[Admin routes] Update register key | PUT |
/registerKey |
token |
✅ | admin.md |
Get google calender api key | GET |
/googleCalendarAPI |
token |
✅ | googleCalendar.md |
[Admin routes] Update google calender api key | PUT |
/googleCalendarAPI |
token |
✅ | googleCalendar.md |
Get all courses | GET |
/courses |
token |
✅ | courses.md |
Create a course | POST |
/courses |
token |
✅ | courses.md |
Update a course | PUT |
/courses |
token , courseId |
✅ | courses.md |
Delete a course | DELETE |
/courses |
token , courseId |
✅ | courses.md |
Create a semester | POST |
/semesters |
token |
✅ | semesters.md |
Update a semester | PUT |
/semesters |
token , semesterId |
✅ | semesters.md |
Delete a semester | DELETE |
/semesters |
token , semesterId |
✅ | semesters.md |
Get all main focuses | GET |
/mainFocuses |
token |
✅ | mainFocus.md |
Create a main focus | POST |
/mainFocuses |
token |
✅ | mainFocus.md |
Update a main focus | PUT |
/mainFocuses |
token , mainFocusId |
✅ | mainFocus.md |
Delete a main focus | DELETE |
/mainFocuses |
token , mainFocusId |
✅ | mainFocus.md |
Get all lecturers | GET |
/lecturers |
token , optional [coming soon]: experience , comment , extern , lastname , extern |
✅ | lecturers.md |
Create a lecturer | POST |
/lecturers |
token |
✅ | lecturers.md |
Update a lecturer | PUT |
/lecturers |
token , lecturerId |
✅ | lecturers.md |
Delete a lecturer | DELETE |
/lecturers |
token , lecturerId |
✅ | lecturers.md |
Get the CV of a specific lecturer | GET |
/lecturerCV |
token , lecturerId |
✅ | lecturers.md |
[DEPRECATED] Update the CV of a specific lecturer | POST |
/lecturerCV |
token , lecturerId |
🔚 | lecturers.md |
Update the CV of a specific lecturer | PUT |
/lecturerCV |
token , lecturerId |
✅ | lecturers.md |
Delete the CV of a specific lecturer | DELETE |
/lecturerCV |
token , lecturerId |
✅ | lecturers.md |
Get all fields of study | GET |
/fieldsOfStudy |
token , optional: withMajorSubject |
✅ | fieldsOfStudy.md |
Create a field of study | POST |
/fieldsOfStudy |
token |
✅ | fieldsOfStudy.md |
Update a field of study | PUT |
/fieldsOfStudy |
token , fieldOfStudyId |
✅ | fieldsOfStudy.md |
Delete a field of study | DELETE |
/fieldsOfStudy |
token , fieldOfStudyId |
✅ | fieldsOfStudy.md |
Get all major subjects for a given field of study | GET |
/majorSubjects |
token , fieldOfStudyId |
✅ | majorSubjects.md |
Update a major subject | PUT |
/majorSubjects |
token , majorSubjectId |
✅ | majorSubjects.md |
Delete a major subject | DELETE |
/majorSubjects |
token , majorSubjectId |
✅ | majorSubjects.md |
Get all presentations for a given course OR given lecturer | GET |
/presentations |
token , courseId OR lecturerId , optional: semesterId , getCoLecturers |
✅ | presentations.md |
Create a presentation | POST |
/presentations |
token |
✅ | presentations.md |
Update a presentation | PUT |
/presentations |
token , presentationId |
✅ | presentations.md |
Delete a presentation | DELETE |
/presentations |
token , presentationId |
✅ | presentations.md |
Get all academic records | GET |
/academicRecords |
token |
✅ | academicRecords.md |
Create a academic record | POST |
/academicRecords |
token |
✅ | academicRecords.md |
Update a academic record | PUT |
/academicRecords |
token , academicRecordId |
✅ | academicRecords.md |
Delete a academic record | DELETE |
/academicRecords |
token , academicRecordId |
✅ | academicRecords.md |
Get everything needed to display a modulecatalog for a given major subject | GET |
/modulecatalog |
token |
✅ | moduleGroups.md |
Create a module group | POST |
/moduleGroups |
token |
✅ | moduleGroups.md |
Update a module group | PUT |
/moduleGroups |
token , moduleGroupId |
✅ | moduleGroups.md |
Delete a module group | DELETE |
/moduleGroups |
token , moduleGroupId |
✅ | moduleGroups.md |
Get all users eligible to transfer ownership to | GET |
/usersForTransfer |
token |
✅ | transferOwnership.md |
Transfer everything connection to one director of studies to another | POST |
/transferOwnership |
token |
✅ | transferOwnership.md |
Legend:
- ✅ - finished
- ☑️ - development finished, review in progress
- 🔜 - development in progress
🅿️ - api has been defined, development has not started yet → you can mock the api response- ✴️ - api being defined → route and parameters are prone to change
- 🔚 - api being reworked → will be discontinued and removed soon
- ⛔ - removed
🅾️ - not started