This project is the "People Engine" for the MCC Commasto app. The app is a .Net Core 3.1 WebAPI REST backend. It uses the Graph API to manage users, campus, and hubs.
Dev | ||
Production |
- First, you need to download Visual Studio or VSCode.
- Download .Net Core 3.1 SDK
- Clone the project.
- You need access to our development tenant to start developing. For this purpose we have created a Microsoft Form. This will do two things: Add you to our Commasto MCC App Teams and invite your @campus-community user to our test AD.
- Once you have completed the Forms you should receive two emails: One email to notify you that you've been invited to our development AD and one mail which contains the appSettings configuration so that you can start developing locally. Make sure to insert the secret from the mail into the
appSettings.Development.json
file.
The People API uses a database to keep track of hubs and campus. While you can run the project without any local database not all functionality will work. Therefore, it is advisable to install a local database on your development machine.
- If you have not already done this, install the ef core tools. For .Net Core 2.x this was included in the SDK but for .Net Core 3.x this is a separate download. To download the tools simply run
dotnet tool install --global dotnet-ef
. - Before continuing, make sure you can build the solution.
- Go to the API project located under
projectRoot/Microsoft.CampusCommunity.Api
. - To update / create your database locally run
dotnet ef database update
. For macOS or other linux based operating systems this command will not work. Please refer to the next section to create a database. - Use your favorite local DB tool to verify the creation of the database locally. On Windows I use either the free SQL Server Management Studio or the SQL Server object explorer which is included in Visual Studio. There is also a free extension for VS Code.
The default connection string will not work on machines that do not run Windows since LocalDB is not supported. Follow this guide to install an alternative
- Download and install SQLite if it is not already part of your system. For example, macOS uses SQLite for most native applications so it's already part of the system. However, you can use a VS Code Extension or an application like Db Browser for SQLLite to monitor your local SQLite database(s).
- Go to your
appsettings.Development.json
and change the connection string and database type:
{
"ConnectionStrings": {
"Default": "Data Source=Mcc.PeopleApi.db"
},
"DatabaseType": "sqlite",
...
}
- Run
dotnet ef database update
in yourprojectRoot/Microsoft.CampusCommunity.Api
folder.
- Please do not develop on the dev branch. Instead, create your own feature branch. Once you are done you can test your changes by merging to the "
test
" branch. This will trigger a build to https://commasto-api-test.azurewebsites.net. Please make sure nobody else is currently testing their app since it will overwrite everything. - Once you are certain your code works you can create a PR. Make sure to describe your changes and reference the issue if applicable.
- Happy coding :)
The REST API that the application creates is exposed as a Swagger Page. Click on "Authorize" to access the API.
Use this table to find out the URLs for the swagger pages:
Environment | URL |
---|---|
Local | https://localhost:44306/swagger |
Online Dev | https://commasto-api-dev.azurewebsites.net/swagger |
Online Production | https://commasto-api.azurewebsites.net/swagger |
Online Testing | https://commasto-api-test.azurewebsites.net/swagger |
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.