This project is for the purposes of the Ministry of Housing Code Challenge where an Open Geo-spatial Consortium (OGC) compliant web map application for managing property owner requests for short-term rental status. Update
This application provides three high-level features:
This application provides a comprehensive set of features to enhance user authentication, authorization, and geospatial mapping capabilities.
Users can sign up and log in securely using a local username/password scheme. Upon successful authentication, the application issues a JWT token, which serves as a secure and efficient means of authentication for all subsequent REST API requests.
The application implements a role-based access control system to grant users access to specific data based on their assigned roles. This ensures that users interact only with information relevant to their permissions, maintaining a secure and tailored user experience.
The application captures street addresses from users and validates them using the BC Address GeoCoder. This external service ensures the accuracy and validity of provided addresses. The application accepts street addresses if the search score is greater than 90 and the match precision is CIVIC_NUMBER or BLOCK for rural areas.
Upon validation, the GeoCoder returns latitude and longitude coordinates associated with the captured street addresses. These coordinates are utilized by the application to enhance the accuracy and precision of the geospatial mapping functionality.
Users can explore a dynamic geospatial map within the application, providing a visually intuitive representation of the geographical locations associated with the captured data. The map is powered by the validated coordinates, ensuring real-world accuracy and up-to-date spatial information.
Utilized Helm Chart and Github Actions for build and deployment to Openshift
Together, these features create a robust and user-friendly environment, combining secure authentication, fine-grained authorization, and a visually informative geospatial mapping experience.
- Visual Studio 2022
- Visual Studio Code
- Docker
- Git
- Clone the repository.
- Server
- Open server/AdvSol.sln in Visual Studio
- Hit F5 to run
- Frontend
- Open frontend folder in VS Code
- Run
npm run dev
-
Clone the repository.
-
Open a command prompt and navigate to the
cc-swu-HOUS-str-blue
root folder -
Run
docker-compose up
-
After successful build, open Docker Desktop and make sure the three containers (DB, Server and Frontend Web App) are running
-
Open a web browser and type in the URL below
http://127.0.0.1:5002/
The application will run without modifications to the settings files. However, these may be changed in the /docker-compose.yml
file if necessary.
Note: If changes are made to the configuration, the application will need to be deployed again.
- PostGIS/PostgreSQL database provides the persistence layer with support for geographic objects
- Single Page Application architecture
- SOLID design principals
- Code-first approach for database creation and initial data seeding using Entity Framework
- Twelve-Factor App methodology
- .NET 7 provides back-end functionality
- Angular front-end - responsive design for mobile and desktop functionality
- Docker containers and one-step build and deployment
- Automated UI testing with
|
├───frontend (Front-end Application)
│ ├───src
│ │ ├───app
│ │ │ ├───common
│ │ │ ├───features
│ │ │ ├───assets
├───postman ( API Testing )
├───server (Back-end Application)
│ ├───AdvSol
│ │ ├───Authentication
│ │ ├───Authorization
│ │ ├───Controllers
│ │ ├───Data
│ │ ├───Migrations
│ │ ├───Services
│ ├───AdvSol.Tests (Unit Tests - Back-end)
├───UITest (Unit Tests - Front-end)
│ ├───TestFramework
│ ├───XUnitTests
A selection of automated testing is provided including front and back-end unit testing, integration tests and a test framework.
The solution includes unit tests for a selection of both the front-end and back-end. These are located in UITest and AdvSol.Test respectively.
Unit tests are intended to be triggered automatically in a fully developed build and deployment pipeline. For the purposes of the code challenge, unit tests may also be manually run from the terminal and Visual Studio.
The UI tests are written with a custom framework based on the Page Object Model design pattern and using Selenium Webdriver.
Requirements: .Net 7 SDK
Execution instructions to build and run the tests:
- From the Command window, cd to the "UITest" directory
- Run "dotnet build"
- Run "dotnet test --filter TestUserRegisterAndSignInScenario"
- As per requirements, there is a limit of 20 applicants. Running the test automation will create a unique user each time the test is run. Therefore there is a limitation of 20 test runs maximum. Running the tests more than 20 times will generate an error in the test logs.
The following notes provide instructions and tips for using the application and a summary of the user stories.
- Click the "Sign Up" button to access the registration form.
- Complete the registration form with the required information.
- Submit the form for processing.
- The application will utilize BC Address GeoCoder to validate the provided street address. The validation criteria include a search score greater than 90 and a match precision of CIVIC_NUMBER or BLOCK.
- Validate the phone number format to be in the pattern (xxx) xxx-xxxx.
- Duplicate records with identical last names or usernames will not be accepted.
- Once the total number of applicants reaches the maximum limit of 20, the application will no longer accept new applicants.
- If the form entry meets all the validation criteria, it will be accepted. Otherwise, the application will provide error messages to indicate validation failure.
- The application securely stores the hash value of the password.
-
Enter the username and password, then submit.
-
The application calculates the hash value of the password and validates it against the corresponding record in the database identified by the entered username.
-
Upon successful credential verification, the user will be directed to the application list page.
-
Note that two admin users are pre-seeded with the following credentials:
-
ADMIN1
- Password: test
-
ADMIN2
- Password: test
-
Username and password are case sensitive
-
- Click the "+" icon to add an STR permit application.
- Fill out the form and submit.
- The application will validate the address using BC Address GeoCoder, employing the same criteria as the registration page.
- The application sets Pending to Compliance status upon creation.
- Once the total number of applications reaches the maximum limit of 5 for a given applicant, the application will no longer accept new application.
- An admin user is restricted from creating applications.
- Notifications are sent to all admins through the application. On the admin's screen, in the top-right corner, a notification icon will display the number of created applications. Clicking the icon will reveal the application details. The application periodically polls for notifications. The functionality to dismiss read notifications has not been implemented.
- Upon opening the list page, all applications belonging to the user (applicant) are displayed. If the user is an admin, all applications are displayed.
- A map is displayed above the application list on the list page.
- All the locations of the STR permit applications are represented as pins on the map.
- When clicking a pin, the corresponding address is displayed on the map.
- Clicking on a link within a row in the application list moves the map to center on the corresponding location.
- The color of the pin on the map depends on the compliance status.
- Pending: Yellow
- Compliant: Green
- Non-compliant: Red
- Clicking the pen icon on the right of each row displays the application edit form.
- Fill out the form and submit. The same validation logic applies.
- If the user is an applicant and attempts to change the compliance status, an error message will be displayed upon submission.
- If the user is an admin, the compliance status change will be saved.
- The application will log update timestamp, field changed, new field value
- Click the map and move mouse to start drawing a circle on the map.
- Cick to finish drawing the circle.
- The application list shows only the applications that are located inside of the circle.
- Navigate to the application detail and click the history button
- The application displays the history of the application
- On the right corner, locate the exit icon.
- Clicking the icon logs you out of the application.
Due to the time constraints of this exercise, the following issues were not addressed:
- Field-level validation for input forms is not implemented in the frontend, however the server comprehensively validates all submitted data.
- Accessibility features were neither implemented nor tested