Process PR - medhatelmasry/GoodBooks GitHub Wiki

  1. clone the repo and change directory into the new folder
    https://github.com/medhatelmasry/GoodBooks.git
    cd GoodBooks
    
  • to get all branches from the repo, run :
    1. git fetch origin
      
    1. now that all branches are on your local, run:
      git switch <branch name to be tested>
      
    1. Verify your on the correct branch with:
      git branch (it should show you're on <branch name to be tested>)
      

    if you cannot see the branch that you want to test then you can execute this command:

      git checkout -b <branch name to be tested> origin/<branch name to be tested>
      
    1. At the root:
      dotnet restore
      dotnet build
      
    1. Make a fresh docker container;
      docker run --cap-add SYS_PTRACE -e ACCEPT_EULA=1 -e MSSQL_SA_PASSWORD=SqlPassword! -p 1444:1433 --name sql -d mcr.microsoft.com/mssql/server:2022-latest
      
    1. Make migrations and update the DB:
      dotnet ef migrations add M1 --project ./src/Api/ --startup-project ./src/Api/Api.csproj --msbuildprojectextensionspath .build/obj/Api/ --context ApplicationIdentityDbContext --output-dir Data/Migrations/IdentityDb
      
      dotnet ef migrations add M2 --project ./src/Api/ --startup-project ./src/Api/Api.csproj --msbuildprojectextensionspath .build/obj/Api/ --context ApiDbContext --output-dir Data/Migrations/ApiDb
      
      dotnet ef database update --project ./src/Api/ --msbuildprojectextensionspath .build/obj/Api/ --context ApplicationIdentityDbContext
      
      dotnet ef database update --project ./src/Api/ --msbuildprojectextensionspath .build/obj/Api/ --context ApiDbContext
      
    1. Add this to the API's appsettings.json:
      "JwtSettings": {
          "validIssuer": "Good Deed Books API",
          "validAudience": "http://localhost:8001",
          "expires": 60
      },
          "SECRET": {
          "key": "GoodDeedBooks1234GoodDeedBooks1234"
      }
      
    1. go to the src/Api folder and start the WebAPI app with:
        dotnet watch
      
    1. Hit this endpoint in order to populate the database with some sample data: http://localhost:8001/api/administration/setup. Thereafter, test endpoint http://localhost:8001/api/Financials/Accounts

    Expected Result when testing endpoint /api/Financials/Accounts

      <img src="https://github.com/user-attachments/assets/77527566-aaca-4795-aab9-914f38b654f0" width="600" height="500">
      
    1. Ensure the API app is running. In a separate terminal window, go to the src/AccountGoWeb and run the backend ASP.NET Core MVC app with the following command:
        dotnet watch
      
    ⚠️ **GitHub.com Fallback** ⚠️