Skip to content

Commit

Permalink
Merge pull request #164 from amosproj/fixed-editor-setup-formatting
Browse files Browse the repository at this point in the history
Fixed editor setup formatting
  • Loading branch information
xilef45 authored Jan 17, 2023
2 parents 1474060 + 81b99c7 commit dfbd022
Show file tree
Hide file tree
Showing 44 changed files with 1,077 additions and 868 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# libjpeg-dev \

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g prettier" 2>&1
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
"ms-dotnettools.csharp",
"ms-vsliveshare.vsliveshare",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"eamodio.gitlens",
"bradlc.vscode-tailwindcss",
"ms-vscode.vscode-typescript",
"ms-playwright.playwright",
"github.copilot"
"github.copilot",
"EditorConfig.EditorConfig"
]
}
},
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pids
__pycache__/

# vscode
.vscode/
web-build/
dist/

Expand All @@ -36,6 +35,8 @@ bin/

# MacOS
.DS_Store


src/deskstar-backend/DeskstarSolution.sln.DotSettings.user
*.cs~
src/deskstar-backend/Deskstar/out/
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"[csharp]": {
"editor.defaultFormatter": "ms-dotnettools.csharp"
}
}
10 changes: 10 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

indent_style = space
indent_size = 2

trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions src/ReadMe.md → src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Local production run

1. Copy the `.env.template` file to `.env.local`:

```bash
cp .env.template .env.local
```
Expand All @@ -18,9 +19,11 @@ cp .env.template .env.local
4. The frontend should now be reachable on `http://localhost:3000`. After that you should be able to register, login and use the software.

5. OPTIONAL: If you want to fill the database with our dummy-data you can use the following command:

```bash
docker exec -i deskstar_postgres psql -U postgres deskstar < ./deskstar-db/dummy-data.sql
```

The dummy data already contain some companies you can use and also some test users. You can find the login data at the bottom of this README.

## Local Dev Setup
Expand Down
4 changes: 2 additions & 2 deletions src/deskstar-backend/Deskstar/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"EMAIL__HOST": "smtp.strato.de",
"EMAIL__PORT": "587",
"EMAIL__PSW": "123456",
"EMAIL__ADDRESS":"[email protected]"
"EMAIL__ADDRESS": "[email protected]"
}
},
"IIS Express": {
Expand All @@ -40,7 +40,7 @@
"EMAIL__HOST": "smtp.strato.de",
"EMAIL__PORT": "587",
"EMAIL__PSW": "123456",
"EMAIL__ADDRESS":"[email protected]"
"EMAIL__ADDRESS": "[email protected]"
}
}
}
Expand Down
16 changes: 9 additions & 7 deletions src/deskstar-backend/Deskstar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@

2. Compile and Run:

``` bash
```bash
dotnet restore
```

``` bash
```bash
dotnet publish -c Dev -o out
```

Choose one of the two environments (Development, Production). Also you need to configure
the database connection. Take a look at the run.sh file for information on that.

``` bash
```bash
dotnet bin\Dev\net6.0\Deskstar.dll --environment [Development|Production] #cmd
dotnet bin/Dev/net6.0/Deskstar.dll --environment [Development|Production] #bash
```

Generate models and data access context from postgres database tables.

``` bash
```bash
dotnet tool install --global dotnet-ef
dotnet ef dbcontext scaffold "Host=localhost;Database=deskstar;Username=postgres;Password=root" Npgsql.EntityFrameworkCore.PostgreSQL -o Models
```
Expand All @@ -34,18 +34,20 @@ dotnet ef dbcontext scaffold "Host=localhost;Database=deskstar;Username=postgres
If you want to run the project with docker, you'll have to have docker installed and
run the following commands from inside the project folder.

``` bash
```bash
docker build -t deskstar-image -f Dockerfile .
```

Use this command to start the dockerfile configured for the test environment. To target another DB, simply
alter the corresponding ENV variables. Running for Production can be done by altering the ASPNETCORE_ENVIRONMENT
ENV variable.
``` bash

```bash
docker run -it -e DB__HOST=localhost -e DB__DATABASE=deskstar -e DB__USERNAME=postgres -e DB__PASSWORD=root -e ASPNETCORE_ENVIRONMENT=Development --rm -p 5000:5000 --name deskstar-backend deskstar-image
```

## Convert Runtime Entities to DTOs with AutoMapper

To map the runtime entities we use to DTOs we serve through the REST-API, we use AutoMapper
to avoid writing additional boilerplate code. An example for using AutoMapper is implemented
for the User (AutomapperConfiguration.cs UserProfileDto.cs, UserController.cs).
Expand All @@ -67,4 +69,4 @@ Internal representation / interface of all the attributes for a specific feature

### Models

External representation / interface of a specific business logic call e.g. CreateUserRequest
External representation / interface of a specific business logic call e.g. CreateUserRequest
2 changes: 1 addition & 1 deletion src/deskstar-backend/Deskstar/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
}
},
"AllowedHosts": "*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ dotnet test
This repo contains only unit tests for business logic of usecase classes

# test structure
All tests for a usecase and its dependant test data is saved in a file called

All tests for a usecase and its dependant test data is saved in a file called

```
<Usecase>Tests.cs
Expand All @@ -27,14 +29,16 @@ public void <MethodNameYouWannaTest>_When<Scenario>_Should<ExpectedResult>(){
```

changes of existing setup functions MUST only be commited if all existing tests still work.

# test coverage

show test coverage

```
rm -rf ../Deskstar/Migrations && rm -rf ../Deskstar/Controllers
dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --logger trx --results-directory coverage
cp coverage/*/coverage.cobertura.xml coverage/coverage.cobertura.xml
pycobertura show coverage/coverage.cobertura.xml
```
```
6 changes: 5 additions & 1 deletion src/deskstar-frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"extends": "next/core-web-vitals"
"extends": ["prettier", "next/core-web-vitals"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": ["error"]
}
}
36 changes: 18 additions & 18 deletions src/deskstar-frontend/.github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
branches: [main, master]
pull_request:
branches: [ main, master ]
branches: [main, master]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: yarn playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: yarn playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
2 changes: 1 addition & 1 deletion src/deskstar-frontend/auth.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ declare module "next-auth" {
interface Session {
user: User;
}
}
}
Loading

0 comments on commit dfbd022

Please sign in to comment.