Files
social-media/README.md
2024-03-16 13:26:29 -04:00

77 lines
2.4 KiB
Markdown

# Hutopy
## Patterns / strategy used
- Clean Architecture ( with Infrastructure, Domain, Application and Web layers )
- Minimal API endpoints.
- Guards ( Fail fast ) : https://github.com/ardalis/GuardClauses
-
## Tools
- Install Docker : https://www.docker.com/get-started/
- Install sql server management ( or preffered tool ) : https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver16#download-ssms
## Database setup in docker for local dev
```
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<YourPassword>" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
```
Or with a mounted volume to persist data on the computer instead ( persist data even if the container is deleted )
```
docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourPassword>' -p 1433:1433 -v C:\dev\DockerVolumes\SqlServer-Utopy-1\data:/var/opt/mssql/data -v C:\dev\DockerVolumes\SqlServer-Utopy-1\log:/var/opt/mssql/log -v C:\dev\DockerVolumes\SqlServer-Utopy-1\secrets:/var/opt/mssql/secrets -d mcr.microsoft.com/mssql/server:2022-latest
```
Set your password in an env var for the connection string. Windows : $Env:DB_PASSWORD = "YourPassword"
## Build
Run `dotnet build -tl` to build the solution.
## Run
To run the web application:
```bash
cd .\src\Web\
dotnet watch run
```
Navigate to https://localhost:5001. The application will automatically reload if you change any of the source files.
## Code Styles & Formatting
The template includes [EditorConfig](https://editorconfig.org/) support to help maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The **.editorconfig** file defines the coding styles applicable to this solution.
## Code Scaffolding
Scaffold new commands and queries.
Start in the `.\src\Application\` folder.
Create a new command:
```
dotnet new ca-usecase --name CreateTodoList --feature-name TodoLists --usecase-type command --return-type int
```
Create a new query:
```
dotnet new ca-usecase -n GetTodos -fn TodoLists -ut query -rt TodosVm
```
If you encounter the error *"No templates or subcommands found matching: 'ca-usecase'."*, install the template and try again:
```bash
dotnet new install Clean.Architecture.Solution.Template::8.0.4
```
## Test
The solution contains unit, integration, and functional tests.
- Using Moq, Nunit, Respawn, FluentAssertions
To run the tests:
```bash
dotnet test
```