Backend Setup

Getting Started

Step 1: Extract the downloaded zip and open the Server Folder

Step 2: Open the FieldManager V3.0.0.sln file in Visual Studio 2022.

Step 3: Once it opened you can see the projects in the Solution Explorer

To understand the project structure click here

Adding connection string and keys

Step 1: Click and expand ESSWebPortal and expand the appsettings.json file you can see a file called appsettings.Development.json there change the DB connection string and keys

Note:

appsettings.Development.json is for local testing (debug build)

appsettings.json is for production build (release build)

for local testing change the appsettings.Development.json file values

Add DB connection string in the ConnectionString->Default property

Add Google Maps API Key in the GoogleMaps->ApiKey property

Add Firebase Sender Id & Server Key in the FcmSettings property

Step 2: Change the DB connection string in the ESSWebApi Project also

You can change the JWT settings also

Running migration

To create a migration file by using Package Manager Console and apply it to the database follow these steps

Step 1: Select Tools -> Nuget Package manager -> Package Manager Console this will open the Package Manager console.

Step 2: Click on the default project dropdown and choose ESSDataAccess for running the migration command

In the ESSDataAccess project delete the Migration folder if it exists.

Step 3: Type this command to generate the migration script

Step 4: Once it successfully generates the migration fine you can see this output and a folder in the ESSDataAccess project

Step 5: Then run this command to run the migration script to create the database and its table

update-database

Step 6: Once it successfully updates you can see this output and also the database will be created in MSSql Server.

You can use SQL Management Studio to make sure that the database is created

Running the Admin Panel

Step 1: To run the project for the first time select the ESSWebPortal option

Step 2: Once the project starts You can see this login Screen use these demo accounts to login

Note: All the initial demo data will be auto-seeded on the project's first launch if you want to make any changes see this section

Admin Demo Account:

User name: adminuser

Password: 123456

Step 3: Open the Mobile settings and update the API Base Url and Web Base Url.

Running the API Project

Step 1: To run the API Project just click on the Project selection drop-down and choose the ESSWebApi Project.

Step 2: Make sure Flutter Test is selected then click to run the API project.

Make sure that you have changed the DB connection string in the ESSWebApi Project also.

Once it launches try accessing the swagger documentation of the API project by going to

http://your-ip:44317/swagger (ex: http:192.168.10.111:44317/swagger)

Note: You can also run these two projects at the same time by right-clicking the solution from the solution explorer and then clicking on properties and selecting the multiple startup projects.

Last updated