Skip to content

Commit

Permalink
Merge pull request #70 from ksummarized/00060_Implement_backend_for_a…
Browse files Browse the repository at this point in the history
…_ToDo_list
  • Loading branch information
mtracewicz authored Oct 1, 2024
2 parents a728d40 + a6818ea commit 448b4eb
Show file tree
Hide file tree
Showing 32 changed files with 1,276 additions and 104 deletions.
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dev:
docker compose --profile hot-reload up --build --watch

no-reload:
docker compose --profile without-hot-reload up --build

db:
docker compose up db -d

db_down:
docker compose down db

apply_migrations:
@cd scripts && pwsh apply_migrations.ps1
@cd ../

.PHONY: dev no-reload db db_down apply_migrations
.DEFAULT_GOAL := dev
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ Directory `scripts` contains some helpful scripts which automate some parts of w

## Development

The application is started using the following command:
The application is started using the following command (with hot-reload feature):
```bash
make
```
or without the hot-reload feature:
```bash
make no-reload
```

If you want to run the application manually you can use the following command:
```bash
docker compose --profile hot-reload up --build --watch
```
Expand All @@ -65,3 +73,8 @@ docker compose --profile without-hot-reload up --build --watch
The `--watch` parameter starts containers with the `hot-reload` feature. This enables the auto-reload functionality, meaning that the container will be automatically reloaded when the code for either the frontend or backend changes.

> The `hot-reload` feature for backend applications uses `dotnet watch`, which only detects changes to existing files. It will not restart the container if new files are added (dotnet watch [issue](https://github.com/dotnet/aspnetcore/issues/8321)).
### DB Migrations
When working with migrations remember to add parameter for project and startup project.
For example when generating a new migration while in backend directory:
`dotnet ef migrations add -p ./src/infrastructure -s ./src/api "Example"`
54 changes: 54 additions & 0 deletions backend/bruno/KSummarized/ToDo/Items/Create.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
meta {
name: Create
type: http
seq: 1
}

post {
url: https://{{api_base_url}}/api/todo/items
body: json
auth: bearer
}

auth:bearer {
token: {{token}}
}

body:json {
{
"id": 1,
"name": "Demo",
"completed": false,
"deadline": "2024-09-20T18:27:39.149Z",
"notes": "hello there",
"tags": [{
"id":1,
"name": "star wars"
}],
"subtasks": [
{
"id": 2,
"name": "Demo",
"completed": false,
"deadline": "2024-09-20T18:27:39.149Z",
"notes": "hello there2",
"tags": [],
"subtasks": []
},
{
"id": 3,
"name": "Demo3",
"completed": false,
"deadline": "2024-09-20T18:27:39.149Z",
"notes": "hello there 3",
"tags": [],
"subtasks": []
}
],
"listId": {{listId}}
}
}

vars:post-response {
itemId: res.body.id
}
15 changes: 15 additions & 0 deletions backend/bruno/KSummarized/ToDo/Items/Delete.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: Delete
type: http
seq: 5
}

delete {
url: https://{{api_base_url}}/api/todo/items/{{itemId}}
body: none
auth: bearer
}

auth:bearer {
token: {{token}}
}
15 changes: 15 additions & 0 deletions backend/bruno/KSummarized/ToDo/Items/Get.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: Get
type: http
seq: 3
}

get {
url: https://{{api_base_url}}/api/todo/items/{{itemId}}
body: none
auth: bearer
}

auth:bearer {
token: {{token}}
}
15 changes: 15 additions & 0 deletions backend/bruno/KSummarized/ToDo/Items/List.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: List
type: http
seq: 4
}

get {
url: https://{{api_base_url}}/api/todo/items
body: none
auth: bearer
}

auth:bearer {
token: {{token}}
}
47 changes: 47 additions & 0 deletions backend/bruno/KSummarized/ToDo/Items/Update.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
meta {
name: Update
type: http
seq: 2
}

put {
url: https://{{api_base_url}}/api/todo/items/{{itemId}}
body: json
auth: bearer
}

auth:bearer {
token: {{token}}
}

body:json {
{
"id": {{itemId}},
"name": "Demo-Updated",
"compleated": false,
"deadline": "2024-09-20T18:27:39.149Z",
"notes": "hello there",
"tags": [],
"subtasks": [
{
"id": 2,
"name": "Demo2",
"compleated": true,
"deadline": "2024-09-20T18:27:39.149Z",
"notes": "hello there2",
"tags": [],
"subtasks": []
},
{
"id": 3,
"name": "Demo22",
"compleated": false,
"deadline": "2024-09-20T18:27:39.149Z",
"notes": "hello there 3",
"tags": [],
"subtasks": []
}
],
"listId": 2
}
}
7 changes: 7 additions & 0 deletions backend/ksummarized.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "unit", "test\unit\unit.cspr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "infrastructure", "src\infrastructure\infrastructure.csproj", "{9D4BB729-24FB-4B6E-9EFD-B8C2E0A2B1EB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "core", "src\core\core.csproj", "{75F10B5B-9DD4-4B97-B571-DC9F517B839F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -34,10 +36,15 @@ Global
{9D4BB729-24FB-4B6E-9EFD-B8C2E0A2B1EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D4BB729-24FB-4B6E-9EFD-B8C2E0A2B1EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D4BB729-24FB-4B6E-9EFD-B8C2E0A2B1EB}.Release|Any CPU.Build.0 = Release|Any CPU
{75F10B5B-9DD4-4B97-B571-DC9F517B839F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75F10B5B-9DD4-4B97-B571-DC9F517B839F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75F10B5B-9DD4-4B97-B571-DC9F517B839F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75F10B5B-9DD4-4B97-B571-DC9F517B839F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{949171D5-4018-4C40-AB2B-687B39F20974} = {DE2804D2-3D3D-4A41-91C7-4FEEF71A4434}
{B930D2FA-7FC6-4772-89EA-6B925EDD2EBC} = {4CA15B69-5E75-48E2-BE26-EA818B675CFC}
{9D4BB729-24FB-4B6E-9EFD-B8C2E0A2B1EB} = {DE2804D2-3D3D-4A41-91C7-4FEEF71A4434}
{75F10B5B-9DD4-4B97-B571-DC9F517B839F} = {DE2804D2-3D3D-4A41-91C7-4FEEF71A4434}
EndGlobalSection
EndGlobal
Loading

0 comments on commit 448b4eb

Please sign in to comment.