Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
57d00d4
updated inventories rest file
aym1279 Jan 17, 2025
b4b7380
updated items rest file
aym1279 Jan 17, 2025
b05966a
updated itemgroup rest file
aym1279 Jan 17, 2025
28653e2
updated itemline rest file
aym1279 Jan 17, 2025
fbf4531
updated itemtype rest file
aym1279 Jan 17, 2025
8d21829
updated location rest file
aym1279 Jan 17, 2025
f6e707d
updated order rest file
aym1279 Jan 17, 2025
2d937b6
updated shipment rest file
aym1279 Jan 17, 2025
16f36e1
updated supplier rest file
aym1279 Jan 17, 2025
12239da
updated transfer rest file
aym1279 Jan 17, 2025
3535646
updated warehouse rest file
aym1279 Jan 17, 2025
10fec6a
removed comments from clients rest file. gave an error
aym1279 Jan 17, 2025
cabb711
Create test.txt
aym1279 Jan 19, 2025
1c75a73
Publish added to dotnet.yml
jerrari547 Jan 21, 2025
e4fd4b5
Merge pull request #1 from Ber-kan/6.5_Publish
jerrari547 Jan 21, 2025
88a170d
Update dotnet.yml
jerrari547 Jan 21, 2025
da37296
Merge pull request #3 from Ber-kan/jerrari547-patch-1
Ber-kan Jan 21, 2025
5e465fd
onnodig
Ber-kan Jan 21, 2025
d686686
report zonder zip generaten
Ber-kan Jan 21, 2025
8e8c616
aanpassing
Ber-kan Jan 21, 2025
f72ea9a
Merge branch 'main' of https://github.com/Ber-kan/Software_Constructi…
aym1279 Jan 21, 2025
af71db9
aanpassing
Ber-kan Jan 21, 2025
b8d452e
cicd tet braanch aangemaakt en in de yaml fiel gezet zodat het testen…
Ber-kan Jan 21, 2025
73b2d28
aanpassingen/fout verbeteren
Ber-kan Jan 21, 2025
d688a03
nieuwe generator proberen
Ber-kan Jan 21, 2025
1eef18c
md file publish proberen
Ber-kan Jan 21, 2025
af43e77
logs voor items geadd
jerrari547 Jan 21, 2025
fc846e5
Merge pull request #8 from Ber-kan/Quick-get-items-log-patch
aym1279 Jan 21, 2025
764a682
Update dotnet.yml
aym1279 Jan 21, 2025
1bf5f5b
test commit to add new branch from old repo
aym1279 Jan 21, 2025
b096574
test commit to add new branch from old repo again
aym1279 Jan 21, 2025
7e33ab7
Merge branch 'main' of https://github.com/Ber-kan/Software_Constructi…
Ber-kan Jan 22, 2025
0202ef1
comment weggehaald
Ber-kan Jan 22, 2025
ae29e81
cleaned up locations rest file
aym1279 Jan 22, 2025
665793d
added a comment for clarification to warehouse.rest
aym1279 Jan 22, 2025
5cdade9
Merge branch 'main' of https://github.com/Ber-kan/Software_Constructi…
aym1279 Jan 22, 2025
0f6f916
Merge pull request #9 from Ber-kan/63-cicd-reporter-deel-maken
jerrari547 Jan 22, 2025
afb02cc
Merge branch 'main' of https://github.com/Ber-kan/Software_Constructi…
aym1279 Jan 22, 2025
3bab989
Merge pull request #10 from Ber-kan/rest-file-json-fixes
Ber-kan Jan 22, 2025
bdc6f5b
Merge branch 'main' of https://github.com/Ber-kan/Software_Constructi…
aym1279 Jan 22, 2025
00ac6d4
added discord webhook part to yaml file
aym1279 Jan 22, 2025
9ae0549
added a small fix to the yaml file
aym1279 Jan 22, 2025
872a67b
Merge pull request #11 from Ber-kan/6.4-webhook-deel-maken
jerrari547 Jan 22, 2025
6358f9c
test message in yaml file
aym1279 Jan 22, 2025
17c76a0
Merge branch 'main' of https://github.com/Ber-kan/Software_Constructi…
aym1279 Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 163 additions & 14 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,78 @@
name: .NET Tests with Coverage Checks for WarehousesTest
name: .NET Tests with Coverage Checks for unittests and integration tests


on:
push:
branches:
- main
- 6.2.workflow
- cicd_deploy
- publish
- cicd_tester
- 6.4-webhook-deel-maken
pull_request:
branches:
- main
- 6.2.workflow
- cicd_deploy
- publish
- cicd_tester
- 6.4-webhook-deel-maken
types: [opened, closed]
issues:
types: [opened, closed]


jobs:
build:
runs-on: ubuntu-latest


steps:
- name: Checkout code
uses: actions/checkout@v3


- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100'


- name: Restore dependencies
run: dotnet restore


- name: Build the project
run: dotnet build --no-restore --configuration Release


test:
runs-on: ubuntu-latest
needs: build


steps:
- name: Checkout code
uses: actions/checkout@v3


- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100'


- name: Restore Test Project Dependencies
run: dotnet restore Test/Test.csproj

- name: Build Test Project
run: dotnet build --no-restore --configuration Release Test/Test.csproj

- name: Run Tests with Code Coverage
run: |
dotnet test ./Test --collect:"XPlat Code Coverage" --results-directory ./Test/TestResults

- name: Extract Coverage Percentage
run: |
COVERAGE_FILE=$(find . -path "./Test/TestResults/**/coverage.cobertura.xml" | head -n 1)
Expand All @@ -70,17 +91,145 @@ jobs:
exit 1
fi
echo "Code coverage meets the required threshold."


- name: Generate HTML Coverage Report

# - name: Generate HTML Coverage Report
# run: |
# dotnet tool install --global dotnet-reportgenerator-globaltool
# reportgenerator -reports:"./**/TestResults/**/coverage.cobertura.xml" -targetdir:"./coverage-html" -reporttypes:Html;MarkdownSummaryGithub

- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@5
with:
reports: '*Test*/TestResults/*/coverage.cobertura.xml'
targetdir: "./coverage-html"
reporttypes: "Html;MarkdownSummaryGithub"

- name: Upload HTML Coverage Report Artifact
uses: actions/upload-artifact@v4
with:
name: html-coverage-report
path: ./coverage-html/

- name: Publish coverage in build summary # alleen mogelijk met MarkdownSummaryGithub
run: cat coverage-html/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
shell: bash

- name: Send Discord Notification (Tests Failed)
if: failure()
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
reportgenerator -reports:"./**/TestResults/**/coverage.cobertura.xml" -targetdir:"./coverage-html" -reporttypes:Html
curl -H "Content-Type: application/json" -X POST \
-d '{
"embeds": [
{
"title": ":x: Tests Failed",
"description": "**Workflow**: `${{ github.workflow }}`\n**Branch**: `${{ github.ref_name }}`\n**User**: `${{ github.actor }}`",
"color": 15158332,
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
],
"username": "GitHub Actions",
"avatar_url": "https://github.com/${{ github.actor }}.png"
}' \
${{ secrets.DISCORD_WEBHOOK_URL }}

publish:
runs-on: ubuntu-latest
needs: test
if: ${{ github.ref_name == 'publish' }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Upload HTML Coverage Report
uses: actions/upload-artifact@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
name: html-coverage-report
path: ./coverage-html/
dotnet-version: '8.0.100'

- name: Restore dependencies
run: dotnet restore

- name: Dotnet publish
run: dotnet publish -c Release -r linux-x64 --self-contained -o ./publish

- name: Upload Linux x64 published artifact
uses: actions/upload-artifact@v4
with:
name: linux-artifact
path: ./publish


notifications:
runs-on: ubuntu-latest
steps:
- name: Notify Pull Request Opened
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' }}
run: |
curl -H "Content-Type: application/json" -X POST \
-d '{
"embeds": [
{
"title": ":handshake: Pull Request Opened",
"description": "**Title**: `${{ github.event.pull_request.title }}`\n**User**: `${{ github.event.pull_request.user.login }}` opened a pull request.",
"color": 3447003,
"url": "${{ github.event.pull_request.html_url }}"
}
],
"username": "${{ github.event.pull_request.user.login }}",
"avatar_url": "${{ github.event.pull_request.user.avatar_url }}"
}' \
${{ secrets.DISCORD_WEBHOOK_URL }}

- name: Notify Pull Request Merged or Closed
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }}
run: |
curl -H "Content-Type: application/json" -X POST \
-d '{
"embeds": [
{
"title": ":white_check_mark: Pull Request Merged/Closed",
"description": "**Title**: `${{ github.event.pull_request.title }}`\n**User**: `${{ github.event.pull_request.user.login }}` merged/closed this pull request.",
"color": 3066993,
"url": "${{ github.event.pull_request.html_url }}"
}
],
"username": "${{ github.event.pull_request.user.login }}",
"avatar_url": "${{ github.event.pull_request.user.avatar_url }}"
}' \
${{ secrets.DISCORD_WEBHOOK_URL }}

- name: Notify Issue Opened
if: ${{ github.event_name == 'issues' && github.event.action == 'opened' }}
run: |
curl -H "Content-Type: application/json" -X POST \
-d '{
"embeds": [
{
"title": ":scroll: Issue Opened",
"description": "**Title**: `${{ github.event.issue.title }}`\n**User**: `${{ github.event.issue.user.login }}` opened an issue.",
"color": 3447003,
"url": "${{ github.event.issue.html_url }}"
}
],
"username": "${{ github.event.issue.user.login }}",
"avatar_url": "${{ github.event.issue.user.avatar_url }}"
}' \
${{ secrets.DISCORD_WEBHOOK_URL }}

- name: Notify Issue Closed
if: ${{ github.event_name == 'issues' && github.event.action == 'closed' }}
run: |
curl -H "Content-Type: application/json" -X POST \
-d '{
"embeds": [
{
"title": ":white_check_mark: Issue Closed",
"description": "**Title**: `${{ github.event.issue.title }}`\n**User**: `${{ github.event.issue.user.login }}` closed this issue.",
"color": 15158332,
"url": "${{ github.event.issue.html_url }}"
}
],
"username": "${{ github.event.issue.user.login }}",
"avatar_url": "${{ github.event.issue.user.avatar_url }}"
}' \
${{ secrets.DISCORD_WEBHOOK_URL }}

# test
2 changes: 2 additions & 0 deletions api/Controllers/ItemControllers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
private readonly ItemServices _item;
private readonly ILogger<ItemController> _logger;

public ItemController(ItemServices item, ILogger<ItemController>? logger = null)

Check warning on line 12 in api/Controllers/ItemControllers.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field '_logger' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 12 in api/Controllers/ItemControllers.cs

View workflow job for this annotation

GitHub Actions / test

Non-nullable field '_logger' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 12 in api/Controllers/ItemControllers.cs

View workflow job for this annotation

GitHub Actions / test

Non-nullable field '_logger' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
{
_item = item;
_logger = logger;

Check warning on line 15 in api/Controllers/ItemControllers.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.

Check warning on line 15 in api/Controllers/ItemControllers.cs

View workflow job for this annotation

GitHub Actions / test

Possible null reference assignment.

Check warning on line 15 in api/Controllers/ItemControllers.cs

View workflow job for this annotation

GitHub Actions / test

Possible null reference assignment.
}

[HttpGet("Items")]
public async Task<IActionResult> GetItems()
{
_logger?.LogInformation("GET /api/v1/Item: Retrieved all items.");
var items = await _item.GetItems();
return Ok(items);
}
Expand All @@ -31,6 +32,7 @@
_logger?.LogInformation("GET /api/v1/Item: Item with id {uid} not found.",uid);
return NotFound("No Item found with that ID");
}
_logger?.LogInformation("GET /api/v1/Item/{Id}: Item with ID {Id} retrieved.", uid);
return Ok(item);
}

Expand Down
36 changes: 18 additions & 18 deletions api/REST/Inventory.REST
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Api-Key: a1b2c3d4e5

{
"id": 1,
"itemId": "P000001",
"item_id": "P000001",
"description": "Face-to-face clear-thinking complexity",
"itemReference": "sjQ23408K",
"item_reference": "sjQ23408K",
"locations": [
{
"inventoryId": 1,
Expand All @@ -38,13 +38,13 @@ Api-Key: a1b2c3d4e5
"locationId": 19538
}
],
"totalOnHand": 262,
"totalExpected": 0,
"totalOrdered": 50,
"totalAllocated": 30,
"totalAvailable": 182,
"createdAt": "2023-10-01T12:00:00Z",
"updatedAt": "2023-10-10T12:00:00Z"
"total_on_hand": 262,
"total_expected": 0,
"total_ordered": 50,
"total_allocated": 30,
"total_available": 182,
"created_at": "2023-10-01T12:00:00Z",
"updated_at": "2023-10-10T12:00:00Z"
}

### Put Update inventory based on body given
Expand All @@ -54,9 +54,9 @@ Api-Key: a1b2c3d4e5

{
"id": 1,
"itemId": "P000001",
"item_id": "P000001",
"description": "Updated description",
"itemReference": "sjQ23408K",
"item_reference": "sjQ23408K",
"locations": [
{
"inventoryId": 1,
Expand All @@ -67,13 +67,13 @@ Api-Key: a1b2c3d4e5
"locationId": 24700
}
],
"totalOnHand": 262,
"totalExpected": 0,
"totalOrdered": 50,
"totalAllocated": 30,
"totalAvailable": 182,
"createdAt": "2023-10-01T12:00:00Z",
"updatedAt": "2023-10-10T12:00:00Z"
"total_on_hand": 262,
"total_expected": 0,
"total_ordered": 50,
"total_allocated": 30,
"total_available": 182,
"created_at": "2023-10-01T12:00:00Z",
"updated_at": "2023-10-10T12:00:00Z"
}

### Delete inventory by id
Expand Down
22 changes: 22 additions & 0 deletions api/REST/Item.REST
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ Api-Key: a1b2c3d4e5
"created_at": "2015-02-19T16:08:24Z",
"updated_at": "2015-09-26T06:37:56Z"
}
### Post Item based on body given
POST http://localhost:5000/api/v1/Item HTTP/1.1
Content-Type: application/json
Api-Key: a1b2c3d4e5

{
"uid": "P000002",
"code": "sjQ23408K",
"description": "Face-to-face clear-thinking complexity",
"short_description": "must",
"upc_code": "6523540947122",
"model_number": "63-OFFTq0T",
"commodity_code": "oTo304",
"unit_purchase_quantity": 47,
"unit_order_quantity": 13,
"pack_order_quantity": 11,
"supplier_id": 1,
"supplier_code": "SUP423",
"supplier_part_number": "E-86805-uTM",
"created_at": "2015-02-19T16:08:24Z",
"updated_at": "2015-09-26T06:37:56Z"
}

### Put Update Item based on body given
PUT http://localhost:5000/api/v1/Item/P000001 HTTP/1.1
Expand Down
8 changes: 4 additions & 4 deletions api/REST/ItemGroup.REST
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Api-Key: a1b2c3d4e5
"id": 1,
"name": "Test",
"description": "Test",
"createdat": "2000-03-11T13:11:14Z",
"updatedat": "2000-03-12T16:11:14Z"
"created_at": "2000-03-11T13:11:14Z",
"updated_at": "2000-03-12T16:11:14Z"
}
###
PUT http://localhost:5000/api/v1/ItemGroups/1 HTTP/1.1
Expand All @@ -26,8 +26,8 @@ Api-Key: a1b2c3d4e5
"id": 1,
"name": "TESTEST",
"description": "Test",
"createdat": "2000-03-11T13:11:14Z",
"updatedat": "2000-03-12T16:11:14Z"
"created_at": "2000-03-11T13:11:14Z",
"updated_at": "2000-03-12T16:11:14Z"
}
###
DELETE http://localhost:5000/api/v1/ItemGroup/1 HTTP/1.1
Expand Down
Loading
Loading