This system is an employee management system for Retro Rabbit Enterprise Services. This is the back end for said system and works in conjuncture with the Front End repository
- Visual Studio Community 2022
- PgAdmin 4 (V8.6 or above)
- Node.js (v20.13.1 or above)
- Docker Desktop
- Git (v2.45.1 or above)
- Docker Desktop (Or any other git UI application)
Docker is used to run PostgreSql.
-
If you don't use WSL/Ubuntu subsystem, install Docker using the Hyper-V installation
-
If this is a new installation, follow the default settings for install
-
If you get a
WSL wrong version error
run the following command
wsl --install
-
Make sure ports 80 and 5432 are not being used by other containers.
-
Run the below command to install Postgres container in Docker
docker run --name RGO -e POSTGRES_PASSWORD=postgrespw -p 5432:5432 -d postgres
docker run -itd --name pgadmin -e PGADMIN_DEFAULT_EMAIL=admin@postgres.com -e PGADMIN_DEFAULT_PASSWORD=admin -p 80:80 dpage/pgadmin4
- Navigate to localhost:80 on your browser and login with
Email: [email protected] password: admin
You can either set up environment variables on visual studio
or add Environment Vaiables on your machine
Right click on the RR.App and select Manage User Secretes
With the respective values in the redacted (#######) spaces
Obtain the AuthManagement values from the Auth0 Identity provider or project contributors on the Retro Rabbit team.
You need to add environment variables onto your machine.
Variable name | Variable value |
---|---|
AuthManagement__Audience | ######## |
AuthManagement__Issuer | ######## |
AuthManagement__ClientId | ######## |
AuthManagement__ClientSecret | ######## |
ConnectionStrings__Default | ######## |
NewEmployeeQueue__ConnectionString | ######## |
With the respective values in the redacted (#######) spaces
Obtain the AuthManagement values from the Auth0 Identity provider or project contributors on the Retro Rabbit team.
Add the following and simarlarly add the others from the table with their respective values.
ConnectionStrings__Default : Host=localhost:5432;Database=RGO;Username=postgres;Password=postgrespw
Remember to restart Visual Studio once added/edited.
Make sure to have Git installed to run any Git command lines.
Cloning the repository
git clone 'https://github.com/RetroRabbit/RGO-Server.git'
Make sure to checkout
develop branch
git checkout develop
Launch pgAdmin. Register a new server on pgAdmin.
- Set the Password to "postgrespw".
- Set the Server Name to "RGO".
- Set the Host Name to "localhost".
- Register New Server in pgAdmin
- Update Server Name and Host Name
Note: If you get login issue
- Double check Host Name and Password
- Check that you are only running one instance of postgres on your machine. To check: run
netstat -aon
on the command line and check that port 5432 is only used once.
Right click on RR.App -> Dependencies -> Packages and Manage Nuget Packages. If the packages are highlighted with an exclamation mark then they still need to be restored. A popup should appear in this case and you can click "Restore".
Change from Production to Development in the drop down menu next to the play/debug button.
Note: You must have .net 7.0 as your target framework.
-
In Visual Studio->RGO-Server project/solution file. Pull up the nuget package manager console:
Tools -> NuGet Package Manager -> Package Manager Console
-
Change the default project to RR.UnitOfWork.
- Run the following commands:
update-database
ππ Congratulations! You have successfully created a database with tables!
-
Make a local copy of the
SEED_DUMMY.sql
file In the RR.UnitOfWork Project. -
Copy one of the
INSERT INTO Employee,
statements in the script. -
Paste a new INSERT statement and populate it with your information such as your email, name, and surname. Also change the id of the record. It is important to note that the first email field should be populated with a personal or work email you're going to use to log into the RGO system, otherwise you won't have access to the system. The second email field can just be a dummy or additional email you'll make use of.
-
Copy one of the
INSERT INTO RoleAccessLink,
statements in the script, change the id and roleId to the role you want to assign to yourself. -
Copy one of the
INSERT INTO EmployeeRole,
statements in the script, change the id, employeeId and roleId to the role you want to assign to yourself. employeeId should match the insert fromEmployee
Table. -
Copy the SQL in the locally created script.
-
Open pgAdmin, right-click on the RGO database, and select
Query Tool
. -
Paste the locally created script in the query screen that pops up. Click on
Execute Script
.
ππ Congratulations! You have a fully populated the database!
Once the query is completed successfully, you can go to the employee table and view all rows to see if you have data in the database.
When running unit tests make sure that the database is running to accomodate for integration tests
With every pull request, there is a requirement to prove coverage of your code. Attached a screen shot of your code coverage to your PR description
Install the dotnet coverage tool
dotnet tool install -g dotnet-coverage
Install the dotnet report generator tool
dotnet tool install -g dotnet-reportgenerator-globaltool
Run the command to check coverage on your project
dotnet-coverage collect -f xml -o coverage.xml dotnet test <solution/project>
(<solution/project> can be omitted to test the entire project)
Generate report
reportgenerator -reports:coverage.xml -targetdir:coverage/report
Navigate to the %temp% / report folder and open index.html using your prefered browser found at
/RGO-Server/coverage/report/index.html
Use forward slash Use forward slashes for resource hierarchy and to separate URI resources. Example: "/employee/{id}"
When naming the URIs, you should use nouns to describe what the resource is and not what it does. For example: Wrong: "getEmployees/" Correct: "employees/"
This makes it clear that there is more than one resource within a collection. Using singular nouns can be confusing. For example: Wrong: "chart/{id}" Correct: "charts/{id}"
As a standard, URLs are typed in lowercase. The same applies to API URIs.
When chaining words together, hyphens are the most user-friendly way and are a better choice than underscores. For example: "employee-documents/10"
PUT "employee/{id}" GET "employee/{id}"
All variables in methods must be in camelCase
Anything referenced by a service should prefixed with an underscore, to indicate that it is a reference to a service
All Method names must be PascalCase ie: SaveEmployeeDocument(SimpleEmployeeDocumentDto employeeDocDto)
PS: When naming and endpoint, variable or method make the name as descriptive as possible. The only exception is for small scopes like a lambda.
Runs on(.NET Web API):