Skip to content

ita-social-projects/StreetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Streetcode

This is a Back-end part of our Streetcode project. Front-end part: https://github.com/ita-social-projects/StreetCode_Client

Vision

The largest platform about the history of Ukraine, built in the space of cities.

Mission

To fill the gaps in the historical memory of Ukrainians.

Build Status Coverage Status Github Issues Pending Pull-Requests

Quality Gate Status Coverage Bugs Code Smells Security Rating

Table of Contents


Installation

Required to install

Environment

environmental variables

ADMIN_PASSWORD

Clone

Clone this repo to your local machine using:

https://github.com/ita-social-projects/StreetCode

Or if your have an associated SSH key:

git@github.com:ita-social-projects/StreetCode.git

Setup

1. Change connection string

  • Go to appsettings.Local.json in StreetCode.WebApi project and write your local database connection string in following format:

     Server={local_server_name};Database=StreetcodeDb;User Id={username};Password={password};MultipleActiveResultSets=true;TrustServerCertificate=true;
    

2. Set environment variables

  • You can set environment variable before seeding the database in Program.cs in StreetCode.WebApi project (replace {password} with your password):

    Environment.SetEnvironmentVariable("ADMIN_PASSWORD", "{password}");
  • Or by specifying in launchSettings.json file like:

    {
      "profiles": {
        "Streetcode_Local": {
          "environmentVariables": {
            "ADMIN_PASSWORD": "password",
          }
        }
      }
    }

3. Add database seeding

  • Go to Program.cs in StreetCode.WebApi project and add the following code :

    await app.SeedDataAsync(); 

4. Create and seed local database

  • Run project and make sure that database was created and filled with data

How to run local

Run the Streetcode project than open your browser and enter https://localhost:5001/swagger/index.html url. If you had this page already opened, just reload it.

How to connect to db locally

  1. launch SQL Server management Studio
  2. In the pop-up window:
    • enter "localhost" as the server name;
    • select "windows authentication" as authentication mechanism;
  3. After the connection has been established, right-click on the server (the first line with the icon), on the left-hand side of the UI
  4. In the the appeared window find and click on "properties"
  5. In the properties section, select "security" page
  6. Make sure that "Server authentication" radio-button is set to "SQL Server and Windows Authentication mode"
  7. Click "Ok"
  8. Then again, on the left-hand side of the UI find folder entitled "Security", and expand it
  9. In unrolled list of options find folder "Logins", and expand it
  10. At this point, you should have "sa" as the last option. If for some reason you do not see it, please refer to https://stackoverflow.com/questions/35753254/why-login-without-rights-can-see-sa-login
  11. Right-click on the "sa" item, select "properties"
  12. Change password to the default system one - "Admin@1234". Don't forget to confirm it afterwards
  13. On the left-hand side select "Status" page, and set "Login" radio-button to "Enabled"
  14. Click "Ok"
  15. Right click on "localhost" server on the left-hand side of the UI and click "Restart"

Now you can connect to your localhost instance with login (sa) and password (Admin@1234)!

Troubleshooting

  • If you encounter an unhandled Microsoft.Data.SqlClient.SqlException: 'A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)' while seeding the DB check if you have the TrustServerCertificate=true; parameter in your connection string and add it if you don't.

  • If you encounter an unhandled System.IO.DirectoryNotFoundException while seeding the DB try to specify relative paths in SeedingLocalExtension.cs to images.json and audios.json in DAL or Streetcode.XIntegrationTest projects like:

    ../Streetcode.DAL/InitialData/images.json
    ../Streetcode.DAL/InitialData/audios.json
    

    or

    ../Streetcode.XIntegrationTest/TestData/InitialData/images.json
    ../Streetcode.XIntegrationTest/TestData/InitialData/audios.json
    

    If exception is still present specify the absolute paths.

How to run Docker

  1. In the "build" project, find the "Targets" folder
  2. In the appeared list of classes, find and click on "SetupPublicBuild.cs"
  3. Open the command prompt/PowerShell/linux terminal, go inside of "/Streetcode" directory, and start the "SetupDocker" Target.
cd ./Streetcode
nuke SetupDocker

After waiting for target completion, you should find that the image and running containers for back-end, front-end, db and redis have been successfully created.

NOTE: If order to delete newly created images/containers/volumes, you can utilize the "CleanDocker" Target.

cd ./Streetcode
nuke CleanDocker

That will delete all unnecessary docker-atoms for you.


Usage

How to work with swagger UI

Run the Streetcode project than open your browser and enter https://localhost:5001/swagger/index.html url. If you had this page already opened, just reload it.

How to run API without swagger UI

Run the Streetcode project in any other profile but "Local" and enter http://localhost:5000. Now, you are free to test API-endpoints with Postman or any other tool.

How to run tests

How to Checkstyle


Documentation

Learn more about our documentation here.


Contributing

Gitflow

Gitflow is a lightweight, branch-based workflow.

Gitflow is an alternative Git branching model that involves the use of feature branches and multiple primary branches.

Step 1

  • First step is checkout to developer branch and pull the recent changes.

Step 2

  • 🍴 Fork this repo from developer branch and name it! A short, descriptive branch name enables your collaborators to see ongoing work at a glance. For example, increase-test-timeout or add-code-of-conduct.

Step 3

  • πŸ”¨ On your branch, make ANY reasonable & desired changes to the repository.

Step 4

  • πŸ“ˆ Commit and push your changes to your branch. Give each commit a descriptive message to help you and future contributors understand what changes the commit contains. For example, fix typo or increase rate limit. Note: you don't need to commit every line of your code in separate commits.

Step 5

  • Before creating pull request you need to check the developer branch state! To avoid conflicts, you should merge developer branch to your local branch! And resolve your local conflicts. Mini manual: checkout to your local branch and write in console git merge developer.

Step 6

  • πŸ”ƒ Create a new pull request using this link.

Step 7

  • πŸ™‹ Assign reviewers! Reviewers should leave questions, comments, and suggestions. After receiving comments, improve the code. Get Approved status on the request and be satisfied with it!

Step 8

  • πŸŽ‰ After 3 approved reviews, merge your pull request with developer branch! Also, it is important to wait for your scrum master to approve your changes. If there are some conflicts, resolve them, again.

Step 9

  • βœ‚οΈ Delete redundant branch. Done!

Hotfixes

Oops, some fixed needs to be done immediately? Use this guide for Hotfixes!

Some fixes will be needed due to the nature of Gitflow. You would have to do a 'hotfix' or something outside of the normal process, but it's simply part of our normal process.

Step 1

  • πŸ”₯ To implement an urgent change, a Hotfix branch is created off the developer branch to test and implement the fix.

Step 2

  • πŸ’ƒ Once it’s complete, the Hotfix is merged with the developer branch.

Issue flow


Team

Project manager

@IrynaZavushchak

Tech expert

@LanchevychMaxym

Business analyst

@vladnvp

Dev team

@Kotusyk @Kasterov @Katerix @Tysyatsky @MementoMorj @Chynchenko @NadiaKishchuk

@Dobriyr @DanyilTerentiev @ValDekh @ormykhalyshyn @MaksBrat @Lolimkeri


FAQ


Support

Reach out to us at one of the following places!


License