Skip to content

Change-Ahead/bricks-and-hearts

Repository files navigation

Bricks and Hearts

Overview

Background

ChangeAhead are an organisation that connects people in a vulnerable state with opportunities to get help and be empowered. One of the ways they do this is matching landlords with empty properties with people in need of housing assistance. The Bricks & Hearts project is a web platform to facilitate this. It currently consists of a landlord portal and an admin portal.

A landlord is able to:

  • sign up for an account, providing some basic information and answering questions about their properties
  • log in and view a dashboard
  • view and edit their personal information
  • view their properties and add, edit, and remove them

A system admin can:

  • log in and view a dashboard
  • view all properties for all landlords and add/edit/remove them
  • view all landlords and their information and add/edit/remove them
  • view all admins and approve/reject requests for admin rights
  • import tenant data from a CSV file
  • suggest suitable applicants for a given property

Tech stack

Backend

We also use the following APIs:

The staging and production sites are hosted on Microsoft Azure, and GitHub Actions is used for CI/CD.

Frontend

Project setup

Requirements

Setup

  1. Download and install the requirements above.
  2. Clone the repository into a sensible location on your machine, and check out the main branch.
    git clone git@github.com:Change-Ahead/bricks-and-hearts.git
    git checkout main
  3. You should have access to a collection of 'secrets' (login details, API keys, etc.) for the Bricks & Hearts project. Find the appsettings.Development.json file and put it into the web folder.
  4. Edit the file and change the ToAddress in the Email section to your email address. This means any notification emails sent by your local environment will be sent to you.
  5. Install the EF Core CLI tools.
    dotnet tool install --global dotnet-ef
  6. Build the project.
    dotnet build
  7. Apply the database migrations. This will create a BricksAndHearts database in your local SQL Server if it doesn't exist already.
    dotnet ef database update --project web

Running the project

dotnet run --project web

or launch from your IDE (e.g. Rider).

Testing

Running unit tests

Unit tests can be run from your IDE or from the terminal:

dotnet test

or to filter to just controller/service tests:

dotnet test --filter "FullyQualifiedName~BricksAndHearts.UnitTests.ControllerTests"
dotnet test --filter "FullyQualifiedName~BricksAndHearts.UnitTests.ServiceTests"

Running the tests should create a BricksAndHeartsTest database in SQL Server which is used by the service tests.

Writing unit tests

Unit tests can be found in the BricksAndHearts.UnitTests project and use the following frameworks:

There are currently two categories of unit tests:

  • Controller tests – These test the correct behaviour of the controller actions in terms of routing, validation, redirects, etc. Real service objects should generally not be used here, and instead mocks should be used to fake their behaviour to check the controller method responds correctly.
  • Service tests – These test the functionality of the methods in the service classes, which usually perform database or API operations. They should not test any controller functionality.

Some service tests check whether database operations are executed correctly. Database unit tests work slightly differently to normal tests – see the guide for how to use them.

Copyright

Copyright © 2022 Change Ahead, the trading name of Homeless To Wellness Ltd.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published