microsoft-campus-community / MCC-App_People-Engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Commasto People Engine - API

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 Build status Deployment status
Production Build status Deployment status

Installation

Prerequisites

  1. First, you need to download Visual Studio or VSCode.
  2. Download .Net Core 3.1 SDK
  3. Clone the project.
  4. 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.
  5. 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.

Database

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.

  1. 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.
  2. Before continuing, make sure you can build the solution.
  3. Go to the API project located under projectRoot/Microsoft.CampusCommunity.Api.
  4. 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.
  5. 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.

For Unix based Operating Systems

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

  1. 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).
  2. Go to your appsettings.Development.json and change the connection string and database type:
{
	"ConnectionStrings": {
	"Default": "Data Source=Mcc.PeopleApi.db"
	},
	"DatabaseType": "sqlite",
	...
}
  1. Run dotnet ef database update in your projectRoot/Microsoft.CampusCommunity.Api folder.

Development

  1. 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.
  2. Once you are certain your code works you can create a PR. Make sure to describe your changes and reference the issue if applicable.
  3. Happy coding :)

Usage

Swagger 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

Contributing

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.

License

MIT

About


Languages

Language:C# 99.8%Language:CSS 0.2%